sponsor Vim development Vim logo Vim Book Ad

camlanot.vim : Ocaml support for type annotation files, included support for ocamlbuild

 script karma  Rating 8/2, Downloaded by 1058  Comments, bugs, improvements  Vim wiki

created by
Vincent Aravantinos
 
script type
ftplugin
 
description
**** This plugin is now part of the official ocaml ftplugin (i.e. the one already distributed with Vim) ****

Ocaml support for annot file is already implemented in the official Ocaml ftplugin and in ocaml.annot.pl (script_id=1197).

But this script adds the following:

   - no need for python support (neither perl or anything else : only vim code inside)
     + 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 to find it out;
     + 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'.

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

Usage:
   - press <LocalLeader>t to display the type of expression under cursor
   - don't forget to compile with -dtypes option (or -cflags -dtypes if you're using ocamlbuild)


 
install details
We'll assume your personal vim directory is "~/.vim/".

- Copy the plugin in "~/.vim/after/ftplugin/"
- If it does not already exist, add a file "~/.vim/after/ftplugin/ocaml.vim".
- At the end of this file, add the following line :
source camlanot.vim
- It's done.

Version note: should work with Vim 6.0, but not tested.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
camlanot.vim 0.9 2007-09-22 7.0 Vincent Aravantinos Initial upload
ip used for rating: 3.142.250.114

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github