updated for version 7.2a
diff --git a/runtime/ftplugin/debchangelog.vim b/runtime/ftplugin/debchangelog.vim
index a3079d1..cd5b071 100644
--- a/runtime/ftplugin/debchangelog.vim
+++ b/runtime/ftplugin/debchangelog.vim
@@ -1,10 +1,11 @@
-" Vim filetype plugin file (GUI menu and folding)
+" Vim filetype plugin file (GUI menu, folding and completion)
 " Language:	Debian Changelog
-" Maintainer:	Michael Piefel <piefel@informatik.hu-berlin.de>
-"		Stefano Zacchiroli <zack@debian.org>
-" Last Change:	$LastChangedDate: 2006-08-24 23:41:26 +0200 (gio, 24 ago 2006) $
+" Maintainer:	Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
+" Former Maintainers:	Michael Piefel <piefel@informatik.hu-berlin.de>
+"			Stefano Zacchiroli <zack@debian.org>
+" Last Change:	2008-03-08
 " License:	GNU GPL, version 2.0 or later
-" URL:		http://svn.debian.org/wsvn/pkg-vim/trunk/runtime/ftplugin/debchangelog.vim?op=file&rev=0&sc=0
+" URL:		http://git.debian.org/?p=pkg-vim/vim.git;a=blob_plain;f=runtime/ftplugin/debchangelog.vim;hb=debian
 
 if exists("b:did_ftplugin")
   finish
@@ -12,9 +13,11 @@
 let b:did_ftplugin=1
 
 " {{{1 Local settings (do on every load)
-setlocal foldmethod=expr
-setlocal foldexpr=GetDebChangelogFold(v:lnum)
-setlocal foldtext=DebChangelogFoldText()
+if exists("g:debchangelog_fold_enable")
+  setlocal foldmethod=expr
+  setlocal foldexpr=DebGetChangelogFold(v:lnum)
+  setlocal foldtext=DebChangelogFoldText()
+endif
 
 " Debian changelogs are not supposed to have any other text width,
 " so the user cannot override this setting
@@ -107,9 +110,8 @@
     call append(2, "")
     call append(3, " -- ")
     call append(4, "")
-    call Distribution("unstable")
     call Urgency("low")
-    normal 1G
+    normal 1G0
     call search(")")
     normal h
     normal 
@@ -240,6 +242,22 @@
   return '[unknown]'
 endfunction
 
+" Look for a package source name searching backward from the givenline and
+" returns it. Return the empty string if the package name can't be found
+function! DebGetPkgSrcName(lineno)
+  let lineidx = a:lineno
+  let pkgname = ''
+  while lineidx > 0
+    let curline = getline(lineidx)
+    if curline =~ '^\S'
+      let pkgname = matchlist(curline, '^\(\S\+\).*$')[1]
+      break
+    endif
+    let lineidx = lineidx - 1
+  endwhile
+  return pkgname
+endfunction
+
 function! DebChangelogFoldText()
   if v:folddashes == '-'  " changelog entry fold
     return foldtext() . ' -- ' . s:getAuthor(v:foldstart, v:foldend) . ' '
@@ -247,7 +265,7 @@
   return foldtext()
 endfunction
 
-function! GetDebChangelogFold(lnum)
+function! DebGetChangelogFold(lnum)
   let line = getline(a:lnum)
   if line =~ '^\w\+'
     return '>1' " beginning of a changelog entry
@@ -261,7 +279,50 @@
   return '='
 endfunction
 
-foldopen!   " unfold the entry the cursor is on (usually the first one)
+silent! foldopen!   " unfold the entry the cursor is on (usually the first one)
+
+" }}}
+
+" {{{1 omnicompletion for Closes: #
+
+if !exists('g:debchangelog_listbugs_severities')
+  let g:debchangelog_listbugs_severities = 'critical,grave,serious,important,normal,minor,wishlist'
+endif
+
+fun! DebCompleteBugs(findstart, base)
+  if a:findstart
+    " it we are just after an '#', the completion should start at the '#',
+    " otherwise no completion is possible
+    let line = getline('.')
+    let colidx = col('.')
+    if colidx > 1 && line[colidx - 2] =~ '#'
+      let colidx = colidx - 2
+    else
+      let colidx = -1
+    endif
+    return colidx
+  else
+    if ! filereadable('/usr/sbin/apt-listbugs')
+      echoerr 'apt-listbugs not found, you should install it to use Closes bug completion'
+      return
+    endif
+    let pkgsrc = DebGetPkgSrcName(line('.'))
+    let listbugs_output = system('apt-listbugs -s ' . g:debchangelog_listbugs_severities . ' list ' . pkgsrc . ' | grep "^ #" 2> /dev/null')
+    let bug_lines = split(listbugs_output, '\n')
+    let completions = []
+    for line in bug_lines
+      let parts = matchlist(line, '^\s*\(#\S\+\)\s*-\s*\(.*\)$')
+      let completion = {}
+      let completion['word'] = parts[1]
+      let completion['menu'] = parts[2]
+      let completion['info'] = parts[0]
+      let completions += [completion]
+    endfor
+    return completions
+  endif
+endfun
+
+setlocal omnifunc=DebCompleteBugs
 
 " }}}
 
diff --git a/runtime/ftplugin/dtrace.vim b/runtime/ftplugin/dtrace.vim
new file mode 100644
index 0000000..9288097
--- /dev/null
+++ b/runtime/ftplugin/dtrace.vim
@@ -0,0 +1,40 @@
+" Language: D script as described in "Solaris Dynamic Tracing Guide",
+"           http://docs.sun.com/app/docs/doc/817-6223
+" Last Change: 2008/03/20
+" Version: 1.2
+" Maintainer: Nicolas Weber <nicolasweber@gmx.de>
+
+" Only do this when not done yet for this buffer
+if exists("b:did_ftplugin")
+  finish
+endif
+
+" Don't load another plugin for this buffer
+let b:did_ftplugin = 1
+
+" Using line continuation here.
+let s:cpo_save = &cpo
+set cpo-=C
+
+let b:undo_ftplugin = "setl fo< com< cms< isk<"
+
+" Set 'formatoptions' to break comment lines but not other lines,
+" and insert the comment leader when hitting <CR> or using "o".
+setlocal fo-=t fo+=croql
+
+" Set 'comments' to format dashed lists in comments.
+setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/
+
+" dtrace uses /* */ comments. Set this explicitly, just in case the user
+" changed this (/*%s*/ is the default)
+setlocal commentstring=/*%s*/
+
+setlocal iskeyword+=@,$
+
+" When the matchit plugin is loaded, this makes the % command skip parens and
+" braces in comments.
+let b:match_words = &matchpairs
+let b:match_skip = 's:comment\|string\|character'
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/ftplugin/eruby.vim b/runtime/ftplugin/eruby.vim
index 4eb122c..8b189df 100644
--- a/runtime/ftplugin/eruby.vim
+++ b/runtime/ftplugin/eruby.vim
@@ -98,4 +98,4 @@
 
 let &cpo = s:save_cpo
 
-" vim: nowrap sw=2 sts=2 ts=8 ff=unix:
+" vim: nowrap sw=2 sts=2 ts=8:
diff --git a/runtime/ftplugin/git.vim b/runtime/ftplugin/git.vim
new file mode 100644
index 0000000..37888b1
--- /dev/null
+++ b/runtime/ftplugin/git.vim
@@ -0,0 +1,34 @@
+" Vim filetype plugin
+" Language:	generic git output
+" Maintainer:	Tim Pope <vimNOSPAM@tpope.info>
+" Last Change:	2008 Feb 27
+
+" Only do this when not done yet for this buffer
+if (exists("b:did_ftplugin"))
+    finish
+endif
+let b:did_ftplugin = 1
+
+if !exists('b:git_dir')
+    if expand('%:p') =~# '\.git\>'
+        let b:git_dir = matchstr(expand('%:p'),'.*\.git\>')
+    elseif $GIT_DIR != ''
+        let b:git_dir = $GIT_DIR
+    endif
+    if has('win32') || has('win64')
+        let b:git_dir = substitute(b:git_dir,'\\','/','g')
+    endif
+endif
+
+if exists('*shellescape') && exists('b:git_dir') && b:git_dir != ''
+    if b:git_dir =~# '/\.git$' " Not a bare repository
+        let &l:path = escape(fnamemodify(b:git_dir,':t'),'\, ').','.&l:path
+    endif
+    let &l:path = escape(b:git_dir,'\, ').','.&l:path
+    let &l:keywordprg = 'git --git-dir='.shellescape(b:git_dir).' show'
+else
+    setlocal keywordprg=git\ show
+endif
+
+setlocal includeexpr=substitute(v:fname,'^[^/]\\+/','','')
+let b:undo_ftplugin = "setl keywordprg< path< includeexpr<"
diff --git a/runtime/ftplugin/gitsendemail.vim b/runtime/ftplugin/gitsendemail.vim
new file mode 100644
index 0000000..a83e48a
--- /dev/null
+++ b/runtime/ftplugin/gitsendemail.vim
@@ -0,0 +1,6 @@
+" Vim filetype plugin
+" Language:	git send-email message
+" Maintainer:	Tim Pope <vimNOSPAM@tpope.info>
+" Last Change:	2007 Dec 16
+
+runtime! ftplugin/mail.vim
diff --git a/runtime/ftplugin/msmessages.vim b/runtime/ftplugin/msmessages.vim
new file mode 100644
index 0000000..791eafe
--- /dev/null
+++ b/runtime/ftplugin/msmessages.vim
@@ -0,0 +1,40 @@
+" Vim filetype plugin file
+" Language:	MS Message files (*.mc)
+" Maintainer:	Kevin Locke <kwl7@cornell.edu>
+" Last Change:	2008 April 09
+" Location:	http://kevinlocke.name/programs/vim/syntax/msmessages.vim
+
+" Based on c.vim
+
+" Only do this when not done yet for this buffer
+if exists("b:did_ftplugin")
+  finish
+endif
+
+" Don't load another plugin for this buffer
+let b:did_ftplugin = 1
+
+" Using line continuation here.
+let s:cpo_save = &cpo
+set cpo-=C
+
+let b:undo_ftplugin = "setl fo< com< cms< | unlet! b:browsefilter"
+
+" Set 'formatoptions' to format all lines, including comments
+setlocal fo-=ct fo+=roql
+
+" Comments includes both ";" which describes a "comment" which will be
+" converted to C code and variants on "; //" which will remain comments
+" in the generated C code
+setlocal comments=:;,:;//,:;\ //,s:;\ /*\ ,m:;\ \ *\ ,e:;\ \ */
+setlocal commentstring=;\ //\ %s
+
+" Win32 can filter files in the browse dialog
+if has("gui_win32") && !exists("b:browsefilter")
+  let b:browsefilter = "MS Message Files (*.mc)\t*.mc\n" .
+	\ "Resource Files (*.rc)\t*.rc\n" .
+	\ "All Files (*.*)\t*.*\n"
+endif
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/ftplugin/ocaml.vim b/runtime/ftplugin/ocaml.vim
index 10ead8a..53431c9 100644
--- a/runtime/ftplugin/ocaml.vim
+++ b/runtime/ftplugin/ocaml.vim
@@ -3,9 +3,12 @@
 "              Mike Leary          <leary@nwlink.com>
 "              Markus Mottl        <markus.mottl@gmail.com>
 "              Stefano Zacchiroli  <zack@bononia.it>
+"              Vincent Aravantinos <firstname.name@imag.fr>
 " URL:         http://www.ocaml.info/vim/ftplugin/ocaml.vim
-" Last Change: 2006 May 01 - Added .annot support for file.whateverext (SZ)
-"	       2006 Apr 11 - Fixed an initialization bug; fixed ASS abbrev (MM)
+" Last Change: 2007 Sep 09 - Added .annot support for ocamlbuild, python not 
+"                            needed anymore (VA)
+"              2006 May 01 - Added .annot support for file.whateverext (SZ)
+"	             2006 Apr 11 - Fixed an initialization bug; fixed ASS abbrev (MM)
 "              2005 Oct 13 - removed GPL; better matchit support (MM, SZ)
 "
 if exists("b:did_ftplugin")
@@ -175,208 +178,401 @@
   return '='
 endfunction
 
-" Vim support for OCaml .annot files (requires Vim with python support)
+" Vim support for OCaml .annot files
 "
-" Executing OCamlPrintType(<mode>) function will display in the Vim bottom
+" Last Change: 2007 Jul 17
+" Maintainer:  Vincent Aravantinos <vincent.aravantinos@gmail.com>
+" License:     public domain
+"
+" Originally inspired by 'ocaml-dtypes.vim' by Stefano Zacchiroli.
+" The source code is quite radically different for we not use python anymore.
+" However this plugin should have the exact same behaviour, that's why the
+" following lines are the quite exact copy of Stefano's original plugin :
+"
+" <<
+" Executing Ocaml_print_type(<mode>) function will display in the Vim bottom
 " line(s) the type of an ocaml value getting it from the corresponding .annot
 " file (if any).  If Vim is in visual mode, <mode> should be "visual" and the
 " selected ocaml value correspond to the highlighted text, otherwise (<mode>
 " can be anything else) it corresponds to the literal found at the current
 " cursor position.
 "
-" .annot files are parsed lazily the first time OCamlPrintType is invoked; is
-" also possible to force the parsing using the OCamlParseAnnot() function.
+" Typing '<LocalLeader>t' (LocalLeader defaults to '\', see :h LocalLeader)
+" will cause " Ocaml_print_type function to be invoked with the right 
+" argument depending on the current mode (visual or not).
+" >>
 "
-" Typing ',3' will cause OCamlPrintType function to be invoked with
-" the right argument depending on the current mode (visual or not).
+" If you find something not matching this behaviour, please signal it.
 "
-" Copyright (C) <2003-2004> Stefano Zacchiroli <zack@bononia.it>
+" Differences are:
+"   - no need for python support
+"     + plus : more portable
+"     + minus: no more lazy parsing, it looks very fast however
+"     
+"   - ocamlbuild support, ie.
+"     + the plugin finds the _build directory and looks for the 
+"       corresponding file inside;
+"     + if the user decides to change the name of the _build directory thanks
+"       to the '-build-dir' option of ocamlbuild, the plugin will manage in
+"       most cases to find it out (most cases = if the source file has a unique
+"       name among your whole project);
+"     + if ocamlbuild is not used, the usual behaviour holds; ie. the .annot
+"       file should be in the same directory as the source file;
+"     + for vim plugin programmers:
+"       the variable 'b:_build_dir' contains the inferred path to the build 
+"       directory, even if this one is not named '_build'.
 "
-" Created:        Wed, 01 Oct 2003 18:16:22 +0200 zack
-" LastModified:   Wed, 25 Aug 2004 18:28:39 +0200 zack
+" Bonus :
+"   - latin1 accents are handled
+"   - lists are handled, even on multiple lines, you don't need the visual mode
+"     (the cursor must be on the first bracket)
+"   - parenthesized expressions, arrays, and structures (ie. '(...)', '[|...|]',
+"     and '{...}') are handled the same way
 
-if !has("python")
-  finish
-endif
+  " Copied from Stefano's original plugin :
+  " <<
+  "      .annot ocaml file representation
+  "
+  "      File format (copied verbatim from caml-types.el)
+  "
+  "      file ::= block *
+  "      block ::= position <SP> position <LF> annotation *
+  "      position ::= filename <SP> num <SP> num <SP> num
+  "      annotation ::= keyword open-paren <LF> <SP> <SP> data <LF> close-paren
+  "
+  "      <SP> is a space character (ASCII 0x20)
+  "      <LF> is a line-feed character (ASCII 0x0A)
+  "      num is a sequence of decimal digits
+  "      filename is a string with the lexical conventions of O'Caml
+  "      open-paren is an open parenthesis (ASCII 0x28)
+  "      close-paren is a closed parenthesis (ASCII 0x29)
+  "      data is any sequence of characters where <LF> is always followed by
+  "           at least two space characters.
+  "
+  "      - in each block, the two positions are respectively the start and the
+  "        end of the range described by the block.
+  "      - in a position, the filename is the name of the file, the first num
+  "        is the line number, the second num is the offset of the beginning
+  "        of the line, the third num is the offset of the position itself.
+  "      - the char number within the line is the difference between the third
+  "        and second nums.
+  "
+  "      For the moment, the only possible keyword is \"type\"."
+  " >>
 
-python << EOF
+" 1. Finding the annotation file even if we use ocamlbuild
 
-import re
-import os
-import os.path
-import string
-import time
-import vim
+    " In:  two strings representing paths
+    " Out: one string representing the common prefix between the two paths
+  function! s:Find_common_path (p1,p2)
+    let temp = a:p2
+    while matchstr(a:p1,temp) == ''
+      let temp = substitute(temp,'/[^/]*$','','')
+    endwhile
+    return temp
+  endfun
 
-debug = False
+    " After call:
+    " - b:annot_file_path : 
+    "                       path to the .annot file corresponding to the
+    "                       source file (dealing with ocamlbuild stuff)
+    " - b:_build_path: 
+    "                       path to the build directory even if this one is
+    "                       not named '_build'
+    " - b:source_file_relative_path :
+    "                       relative path of the source file *in* the build
+    "                       directory ; this is how it is reffered to in the
+    "                       .annot file
+  function! s:Locate_annotation()
+    if !b:annotation_file_located
 
-class AnnExc(Exception):
-    def __init__(self, reason):
-        self.reason = reason
+      silent exe 'cd' expand('%:p:h')
 
-no_annotations = AnnExc("No type annotations (.annot) file found")
-annotation_not_found = AnnExc("No type annotation found for the given text")
-def malformed_annotations(lineno):
-    return AnnExc("Malformed .annot file (line = %d)" % lineno)
+      let annot_file_name = expand('%:r').'.annot'
 
-class Annotations:
-    """
-      .annot ocaml file representation
+      " 1st case : the annot file is in the same directory as the buffer (no ocamlbuild)
+      let b:annot_file_path = findfile(annot_file_name,'.')
+      if b:annot_file_path != ''
+        let b:annot_file_path = getcwd().'/'.b:annot_file_path
+        let b:_build_path = ''
+        let b:source_file_relative_path = expand('%')
+      else
+        " 2nd case : the buffer and the _build directory are in the same directory
+        "      ..
+        "     /  \
+        "    /    \
+        " _build  .ml
+        "
+        let b:_build_path = finddir('_build','.')
+        if b:_build_path != ''
+          let b:_build_path = getcwd().'/'.b:_build_path
+          let b:annot_file_path           = findfile(annot_file_name,'_build')
+          if b:annot_file_path != ''
+            let b:annot_file_path = getcwd().'/'.b:annot_file_path
+          endif
+          let b:source_file_relative_path = expand('%')
+        else
+          " 3rd case : the _build directory is in a directory higher in the file hierarchy 
+          "            (it can't be deeper by ocamlbuild requirements)
+          "      ..
+          "     /  \
+          "    /    \
+          " _build  ...
+          "           \
+          "            \
+          "           .ml
+          "
+          let b:_build_path = finddir('_build',';')
+          if b:_build_path != ''
+            let project_path                = substitute(b:_build_path,'/_build$','','')
+            let path_relative_to_project    = substitute(expand('%:p:h'),project_path.'/','','')
+            let b:annot_file_path           = findfile(annot_file_name,project_path.'/_build/'.path_relative_to_project)
+            let b:source_file_relative_path = substitute(expand('%:p'),project_path.'/','','')
+          else
+            let b:annot_file_path = findfile(annot_file_name,'**')
+            "4th case : what if the user decided to change the name of the _build directory ?
+            "           -> we relax the constraints, it should work in most cases
+            if b:annot_file_path != ''
+              " 4a. we suppose the renamed _build directory is in the current directory
+              let b:_build_path = matchstr(b:annot_file_path,'^[^/]*')
+              if b:annot_file_path != ''
+                let b:annot_file_path = getcwd().'/'.b:annot_file_path
+                let b:_build_path     = getcwd().'/'.b:_build_path
+              endif
+              let b:source_file_relative_path = expand('%')
+            else
+              " 4b. anarchy : the renamed _build directory may be higher in the hierarchy
+              " this will work if the file for which we are looking annotations has a unique name in the whole project
+              " if this is not the case, it may still work, but no warranty here
+              let b:annot_file_path = findfile(annot_file_name,'**;')
+              let project_path      = s:Find_common_path(b:annot_file_path,expand('%:p:h'))
+              let b:_build_path       = matchstr(b:annot_file_path,project_path.'/[^/]*')
+              let b:source_file_relative_path = substitute(expand('%:p'),project_path.'/','','')
+            endif
+          endif
+        endif
+      endif
 
-      File format (copied verbatim from caml-types.el)
+      if b:annot_file_path == ''
+        throw 'E484: no annotation file found'
+      endif
 
-      file ::= block *
-      block ::= position <SP> position <LF> annotation *
-      position ::= filename <SP> num <SP> num <SP> num
-      annotation ::= keyword open-paren <LF> <SP> <SP> data <LF> close-paren
+      silent exe 'cd' '-'
 
-      <SP> is a space character (ASCII 0x20)
-      <LF> is a line-feed character (ASCII 0x0A)
-      num is a sequence of decimal digits
-      filename is a string with the lexical conventions of O'Caml
-      open-paren is an open parenthesis (ASCII 0x28)
-      close-paren is a closed parenthesis (ASCII 0x29)
-      data is any sequence of characters where <LF> is always followed by
-           at least two space characters.
+      let b:annotation_file_located = 1
+    endif
+  endfun
 
-      - in each block, the two positions are respectively the start and the
-        end of the range described by the block.
-      - in a position, the filename is the name of the file, the first num
-        is the line number, the second num is the offset of the beginning
-        of the line, the third num is the offset of the position itself.
-      - the char number within the line is the difference between the third
-        and second nums.
+  " This in order to locate the .annot file only once
+  let b:annotation_file_located = 0
 
-      For the moment, the only possible keyword is \"type\"."
-    """
+" 2. Finding the type information in the annotation file
+  
+  " a. The annotation file is opened in vim as a buffer that
+  " should be (almost) invisible to the user.
 
-    def __init__(self):
-        self.__filename = None  # last .annot parsed file
-        self.__ml_filename = None # as above but s/.annot/.ml/
-        self.__timestamp = None # last parse action timestamp
-        self.__annot = {}
-        self.__re = re.compile(
-          '^"[^"]*"\s+(\d+)\s+(\d+)\s+(\d+)\s+"[^"]*"\s+(\d+)\s+(\d+)\s+(\d+)$')
+      " After call:
+      " The current buffer is now the one containing the .annot file.
+      " We manage to keep all this hidden to the user's eye.
+    function! s:Enter_annotation_buffer()
+      let s:current_pos = getpos('.')
+      let s:current_hidden = &l:hidden
+      set hidden
+      let s:current_buf = bufname('%')
+      if bufloaded(b:annot_file_path)
+        silent exe 'keepj keepalt' 'buffer' b:annot_file_path
+      else
+        silent exe 'keepj keepalt' 'view' b:annot_file_path
+      endif
+    endfun
 
-    def __parse(self, fname):
-        try:
-            f = open(fname)
-            line = f.readline() # position line
-            lineno = 1
-            while (line != ""):
-                m = self.__re.search(line)
-                if (not m):
-                    raise malformed_annotations(lineno)
-                line1 = int(m.group(1))
-                col1 = int(m.group(3)) - int(m.group(2))
-                line2 = int(m.group(4))
-                col2 = int(m.group(6)) - int(m.group(5))
-                line = f.readline() # "type(" string
-                lineno += 1
-                if (line == ""): raise malformed_annotations(lineno)
-                type = []
-                line = f.readline() # type description
-                lineno += 1
-                if (line == ""): raise malformed_annotations(lineno)
-                while line != ")\n":
-                    type.append(string.strip(line))
-                    line = f.readline()
-                    lineno += 1
-                    if (line == ""): raise malformed_annotations(lineno)
-                type = string.join(type, "\n")
-                key = ((line1, col1), (line2, col2))
-                if not self.__annot.has_key(key):
-                    self.__annot[key] = type
-                line = f.readline() # position line
-            f.close()
-            self.__filename = fname
-            self.__ml_filename = vim.current.buffer.name
-            self.__timestamp = int(time.time())
-        except IOError:
-            raise no_annotations
+      " After call:
+      "   The original buffer has been restored in the exact same state as before.
+    function! s:Exit_annotation_buffer()
+      silent exe 'keepj keepalt' 'buffer' s:current_buf
+      let &l:hidden = s:current_hidden
+      call setpos('.',s:current_pos)
+    endfun
 
-    def parse(self):
-        annot_file = os.path.splitext(vim.current.buffer.name)[0] + ".annot"
-        self.__parse(annot_file)
+      " After call:
+      "   The annot file is loaded and assigned to a buffer.
+      "   This also handles the modification date of the .annot file, eg. after a 
+      "   compilation.
+    function! s:Load_annotation()
+      if bufloaded(b:annot_file_path) && b:annot_file_last_mod < getftime(b:annot_file_path)
+        call s:Enter_annotation_buffer()
+        silent exe "bunload"
+        call s:Exit_annotation_buffer()
+      endif
+      if !bufloaded(b:annot_file_path)
+        call s:Enter_annotation_buffer()
+        setlocal nobuflisted
+        setlocal bufhidden=hide
+        setlocal noswapfile
+        setlocal buftype=nowrite
+        call s:Exit_annotation_buffer()
+        let b:annot_file_last_mod = getftime(b:annot_file_path)
+      endif
+    endfun
+  
+  "b. 'search' and 'match' work to find the type information
+   
+      "In:  - lin1,col1: postion of expression first char
+      "     - lin2,col2: postion of expression last char
+      "Out: - the pattern to be looked for to find the block
+      " Must be called in the source buffer (use of line2byte)
+    function! s:Block_pattern(lin1,lin2,col1,col2)
+      let start_num1 = a:lin1
+      let start_num2 = line2byte(a:lin1) - 1
+      let start_num3 = start_num2 + a:col1
+      let start_pos  = '"'.b:source_file_relative_path.'" '.start_num1.' '.start_num2.' '.start_num3
+      let end_num1   = a:lin2
+      let end_num2   = line2byte(a:lin2) - 1
+      let end_num3   = end_num2 + a:col2
+      let end_pos    = '"'.b:source_file_relative_path.'" '.end_num1.' '.end_num2.' '.end_num3
+      return '^'.start_pos.' '.end_pos."$"
+      " rq: the '^' here is not totally correct regarding the annot file "grammar"
+      " but currently the annotation file respects this, and it's a little bit faster with the '^';
+      " can be removed safely.
+    endfun
 
-    def get_type(self, (line1, col1), (line2, col2)):
-        if debug:
-            print line1, col1, line2, col2
-        if vim.current.buffer.name == None:
-            raise no_annotations
-        if vim.current.buffer.name != self.__ml_filename or  \
-          os.stat(self.__filename).st_mtime > self.__timestamp:
-            self.parse()
-        try:
-            return self.__annot[(line1, col1), (line2, col2)]
-        except KeyError:
-            raise annotation_not_found
+      "In: (the cursor position should be at the start of an annotation)
+      "Out: the type information
+      " Must be called in the annotation buffer (use of search)
+    function! s:Match_data()
+      " rq: idem as previously, in the following, the '^' at start of patterns is not necessary
+      keepj while search('^type($','ce',line(".")) == 0
+        keepj if search('^.\{-}($','e') == 0
+          throw "no_annotation"
+        endif
+        keepj if searchpair('(','',')') == 0
+          throw "malformed_annot_file"
+        endif
+      endwhile
+      let begin = line(".") + 1
+      keepj if searchpair('(','',')') == 0
+        throw "malformed_annot_file"
+      endif
+      let end = line(".") - 1
+      return join(getline(begin,end),"\n")
+    endfun
+        
+      "In:  the pattern to look for in order to match the block
+      "Out: the type information (calls s:Match_data)
+      " Should be called in the annotation buffer
+    function! s:Extract_type_data(block_pattern)
+      call s:Enter_annotation_buffer()
+      try
+        if search(a:block_pattern,'e') == 0
+          throw "no_annotation"
+        endif
+        call cursor(line(".") + 1,1)
+        let annotation = s:Match_data()
+      finally
+        call s:Exit_annotation_buffer()
+      endtry
+      return annotation
+    endfun
+  
+  "c. link this stuff with what the user wants
+  " ie. get the expression selected/under the cursor
+    
+    let s:ocaml_word_char = '\w|[À-ÿ]|'''
 
-word_char_RE = re.compile("^[\w.]$")
+      "In:  the current mode (eg. "visual", "normal", etc.)
+      "Out: the borders of the expression we are looking for the type
+    function! s:Match_borders(mode)
+      if a:mode == "visual"
+        let cur = getpos(".")
+        normal `<
+        let col1 = col(".")
+        let lin1 = line(".")
+        normal `>
+        let col2 = col(".")
+        let lin2 = line(".")
+        call cursor(cur[1],cur[2])
+        return [lin1,lin2,col1-1,col2]
+      else
+        let cursor_line = line(".")
+        let cursor_col  = col(".")
+        let line = getline('.')
+        if line[cursor_col-1:cursor_col] == '[|'
+          let [lin2,col2] = searchpairpos('\[|','','|\]','n')
+          return [cursor_line,lin2,cursor_col-1,col2+1]
+        elseif     line[cursor_col-1] == '['
+          let [lin2,col2] = searchpairpos('\[','','\]','n')
+          return [cursor_line,lin2,cursor_col-1,col2]
+        elseif line[cursor_col-1] == '('
+          let [lin2,col2] = searchpairpos('(','',')','n')
+          return [cursor_line,lin2,cursor_col-1,col2]
+        elseif line[cursor_col-1] == '{'
+          let [lin2,col2] = searchpairpos('{','','}','n')
+          return [cursor_line,lin2,cursor_col-1,col2]
+        else
+          let [lin1,col1] = searchpos('\v%('.s:ocaml_word_char.'|\.)*','ncb')
+          let [lin2,col2] = searchpos('\v%('.s:ocaml_word_char.'|\.)*','nce')
+          if col1 == 0 || col2 == 0
+            throw "no_expression"
+          endif
+          return [cursor_line,cursor_line,col1-1,col2]
+        endif
+      endif
+    endfun
 
-  # TODO this function should recognize ocaml literals, actually it's just an
-  # hack that recognize continuous sequences of word_char_RE above
-def findBoundaries(line, col):
-    """ given a cursor position (as returned by vim.current.window.cursor)
-    return two integers identify the beggining and end column of the word at
-    cursor position, if any. If no word is at the cursor position return the
-    column cursor position twice """
-    left, right = col, col
-    line = line - 1 # mismatch vim/python line indexes
-    (begin_col, end_col) = (0, len(vim.current.buffer[line]) - 1)
-    try:
-        while word_char_RE.search(vim.current.buffer[line][left - 1]):
-            left = left - 1
-    except IndexError:
-        pass
-    try:
-        while word_char_RE.search(vim.current.buffer[line][right + 1]):
-            right = right + 1
-    except IndexError:
-        pass
-    return (left, right)
+      "In:  the current mode (eg. "visual", "normal", etc.)
+      "Out: the type information (calls s:Extract_type_data)
+    function! s:Get_type(mode)
+      let [lin1,lin2,col1,col2] = s:Match_borders(a:mode)
+      return s:Extract_type_data(s:Block_pattern(lin1,lin2,col1,col2))
+    endfun
+  
+  "d. main
+      "In:         the current mode (eg. "visual", "normal", etc.)
+      "After call: the type information is displayed
+    if !exists("*Ocaml_get_type")
+      function Ocaml_get_type(mode)
+        call s:Locate_annotation()
+        call s:Load_annotation()
+        return s:Get_type(a:mode)
+      endfun
+    endif
 
-annot = Annotations() # global annotation object
+    if !exists("*Ocaml_get_type_or_not")
+      function Ocaml_get_type_or_not(mode)
+        let t=reltime()
+        try
+          return Ocaml_get_type(a:mode)
+        catch
+          return ""
+        endtry
+      endfun
+    endif
 
-def printOCamlType(mode):
-    try:
-        if mode == "visual":  # visual mode: lookup highlighted text
-            (line1, col1) = vim.current.buffer.mark("<")
-            (line2, col2) = vim.current.buffer.mark(">")
-        else: # any other mode: lookup word at cursor position
-            (line, col) = vim.current.window.cursor
-            (col1, col2) = findBoundaries(line, col)
-            (line1, line2) = (line, line)
-        begin_mark = (line1, col1)
-        end_mark = (line2, col2 + 1)
-        print annot.get_type(begin_mark, end_mark)
-    except AnnExc, exc:
-        print exc.reason
+    if !exists("*Ocaml_print_type")
+      function Ocaml_print_type(mode)
+        if expand("%:e") == "mli"
+          echohl ErrorMsg | echo "No annotations for interface (.mli) files" | echohl None
+          return
+        endif
+        try
+          echo Ocaml_get_type(a:mode)
+        catch /E484:/
+          echohl ErrorMsg | echo "No type annotations (.annot) file found" | echohl None
+        catch /no_expression/
+          echohl ErrorMsg | echo "No expression found under the cursor" | echohl None
+        catch /no_annotation/
+          echohl ErrorMsg | echo "No type annotation found for the given text" | echohl None
+        catch /malformed_annot_file/
+          echohl ErrorMsg | echo "Malformed .annot file" | echohl None
+        endtry
+      endfun
+    endif
 
-def parseOCamlAnnot():
-    try:
-        annot.parse()
-    except AnnExc, exc:
-        print exc.reason
-
-EOF
-
-fun! OCamlPrintType(current_mode)
-  if (a:current_mode == "visual")
-    python printOCamlType("visual")
-  else
-    python printOCamlType("normal")
-  endif
-endfun
-
-fun! OCamlParseAnnot()
-  python parseOCamlAnnot()
-endfun
-
-map <LocalLeader>t :call OCamlPrintType("normal")<RETURN>
-vmap <LocalLeader>t :call OCamlPrintType("visual")<RETURN>
+" Maps
+  map  <silent> <LocalLeader>t :call Ocaml_print_type("normal")<CR>
+  vmap <silent> <LocalLeader>t :<C-U>call Ocaml_print_type("visual")<CR>`<
 
 let &cpoptions=s:cposet
 unlet s:cposet
 
-" vim:sw=2
+" vim:sw=2 fdm=indent
diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim
index c9924b7..9f40b01 100644
--- a/runtime/ftplugin/sql.vim
+++ b/runtime/ftplugin/sql.vim
@@ -1,8 +1,8 @@
 " SQL filetype plugin file
 " Language:    SQL (Common for Oracle, Microsoft SQL Server, Sybase)
-" Version:     3.0
+" Version:     4.0
 " Maintainer:  David Fishburn <fishburn at ianywhere dot com>
-" Last Change: Wed Apr 26 2006 3:02:32 PM
+" Last Change: Wed 27 Feb 2008 04:35:21 PM Eastern Standard Time
 " Download:    http://vim.sourceforge.net/script.php?script_id=454
 
 " For more details please use:
@@ -39,6 +39,13 @@
 let s:save_cpo = &cpo
 set cpo=
 
+" Disable autowrapping for code, but enable for comments
+" t	Auto-wrap text using textwidth
+" c     Auto-wrap comments using textwidth, inserting the current comment
+"       leader automatically.
+setlocal formatoptions-=t
+setlocal formatoptions-=c
+
 " Functions/Commands to allow the user to change SQL syntax dialects
 " through the use of :SQLSetType <tab> for completion.
 " This works with both Vim 6 and 7.
@@ -278,10 +285,10 @@
 nmap <buffer> <silent> [[ :call search('\\c^\\s*begin\\>', 'bW' )<CR>
 nmap <buffer> <silent> ][ :call search('\\c^\\s*end\\W*$', 'W' )<CR>
 nmap <buffer> <silent> [] :call search('\\c^\\s*end\\W*$', 'bW' )<CR>
-vmap <buffer> <silent> ]] /\\c^\\s*begin\\><CR>
-vmap <buffer> <silent> [[ ?\\c^\\s*begin\\><CR>
-vmap <buffer> <silent> ][ /\\c^\\s*end\\W*$<CR>
-vmap <buffer> <silent> [] ?\\c^\\s*end\\W*$<CR>
+vmap <buffer> <silent> ]] :<C-U>exec "normal! gv"<Bar>call search('\\c^\\s*begin\\>', 'W' )<CR>
+vmap <buffer> <silent> [[ :<C-U>exec "normal! gv"<Bar>call search('\\c^\\s*begin\\>', 'bW' )<CR>
+vmap <buffer> <silent> ][ :<C-U>exec "normal! gv"<Bar>call search('\\c^\\s*end\\W*$', 'W' )<CR>
+vmap <buffer> <silent> [] :<C-U>exec "normal! gv"<Bar>call search('\\c^\\s*end\\W*$', 'bW' )<CR>
 
 
 " By default only look for CREATE statements, but allow
@@ -343,10 +350,10 @@
             \ '^\\(\\s*'.b:comment_leader.'.*\\n\\)\\@<!'.
             \ "', 'bW')"
 " Move to the start and end of comments
-exec 'nnoremap <silent><buffer> ]" /'.b:comment_start.'<CR>'
-exec 'nnoremap <silent><buffer> [" /'.b:comment_end.'<CR>'
-exec 'vnoremap <silent><buffer> ]" /'.b:comment_start.'<CR>'
-exec 'vnoremap <silent><buffer> [" /'.b:comment_end.'<CR>'
+exec 'nnoremap <silent><buffer> ]" :call search('."'".b:comment_start."'".', "W" )<CR>'
+exec 'nnoremap <silent><buffer> [" :call search('."'".b:comment_end."'".', "W" )<CR>'
+exec 'vnoremap <silent><buffer> ]" :<C-U>exec "normal! gv"<Bar>call search('."'".b:comment_start."'".', "W" )<CR>'
+exec 'vnoremap <silent><buffer> [" :<C-U>exec "normal! gv"<Bar>call search('."'".b:comment_end."'".', "W" )<CR>'
 
 " Comments can be of the form:
 "   /*