Ⅰ. 插件描述
A vim plugin and python helper library for ocamlspotterⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'johnelse/ocamlspot-helpers'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'johnelse/ocamlspot-helpers'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'johnelse/ocamlspot-helpers'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/johnelse/ocamlspot-helpers
Ⅳ. 文档说明
OCamlspot Vim plugin
OCamlspot for Vim allows Vim to get type information from the output ofocamlspot. When installed, Vim can show the type of the OCaml symbol under
the cursor with a keypress.
Screenshot

Requirements
The OCamlspot plugin uses the .cmt or .spot files generated by ocamlspot
during compilation. To compile with binary annotation output use the following
flag:
OCAMLFLAGS+=-bin-annot
Alternatively, you can use a patched OCaml compiler that adds this flag by
default based on an environemnt variable. This compiler can be obtained from
OPAM.
opam switch 4.00.1+annot
For more information on which compilers can be used and how to use them, see
the docs for OCamlSpotter.
Installation
This plugin is written to be easily installable using Pathogen:
cd ~
git clone http://github.com/simonjbeaumont/vim-ocamlspot.git .vim/bundle/vim-ocamlspot
Pro-tip: if you're keeping your Vim config under Git, consider using Git
submodules for your plugins (works very nicely with Pathogen):
cd ~/.vim
git submodule add http://github.com/simonjbeaumont/vim-ocamlspot.git bundle/vim-ocamlspot
git submodule init
git submodule update
Usage
The plugin exports a function OCamlType() which can be called in Vim to show
the type of the symbol under the cursor.
The functions OCamlSpot() and OCamlSpotSplit() can be used to jump to the
definition of the symbol under the cursor. OCamlSpotSplit() opens the definition
in a new split.
These can be mapped in your .vimrc, e.g.:
map <C-k> :call OCamlType()<CR>
map <C-]> :call OCamlSpot()<CR>
Still to be done
- Write a quick Vim help file under
doc/; - Use
ftdetectto only load this plugin for OCaml files; - Add default shortcuts.
Contributions are more than welcome for any bugs or improvements, just submit a
pull request.
Acknowledgements
Credit to John Else, from whom this repo was
forked and to Jun Furuse for the creation of the
plugin and his work with OCamlspotter.