Ⅰ. 插件描述
Ocaml support for type annotation files, included support for ocamlbuildⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/camlanot-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/camlanot-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/camlanot-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/camlanot.vim
Ⅳ. 文档说明
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)