Ⅰ. 插件描述
Vim plugin for Haskell developmentⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'dan-t/vim-hdevtools-or-are-not'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'dan-t/vim-hdevtools-or-are-not'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'dan-t/vim-hdevtools-or-are-not'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/dan-t/vim-hdevtools
Ⅳ. 文档说明
hdevtools Vim Plugin
Vim plugin for Haskell development powered by the lightnight fast
hdevtools background server.
About
hdevtools is a command line program
powered by the GHC API, that provides services for Haskell development.
hdevtools works by running a persistent process in the background, so that your
Haskell modules remain in memory, instead of having to reload everything each
time you change only one file. This is just like :reload in GHCi - with
hdevtools you get the speed of GHCi as well as tight integration with your
editor.
This is the Vim plugin that integrates Vim with hdevtools.
Installation
- You must install the
hdevtoolscommand line program, It can be found
here: https://github.com/bitc/hdevtools/, or from Hackage:
$ cabal install hdevtools
- Install this plugin. pathogen.vim
is the recommended way:
cd ~/.vim/bundle
git clone https://github.com/bitc/vim-hdevtools.git
- Configure your keybindings in your
.vimrcfile. I recommend something
like:
au FileType haskell nnoremap <buffer> <F1> :HdevtoolsType<CR>
au FileType haskell nnoremap <buffer> <silent> <F2> :HdevtoolsClear<CR>
Features
Type Checking
The best feature of the hdevtools command is near-instant checking of Haskell
source files for errors - it's fast even for huge projects.
This Vim plugin does not have direct support for interacting with this feature.
Instead, I recommend using the excellent
Syntastic plugin.
Type Information
Position the cursor anywhere in a Haskell source file, and executeHdevtoolsType (or press the <F1>) key if you have configured as above).
The type for the expression under the cursor will be printed, and the
expression will be highlighted. Repeated presses will expand the expression
that is examined.
You can execute HdevtoolsClear to get rid of the highlighting.
Customization
You can set the g:hdevtools_options variable to pass custom options to
hdevtools.
This is useful for passing options through to GHC with the hdevtools -g
- For example, if your project source code is in a
srcdirectory, - you want to use the GHC option
-Wall, then stick the following somewhere
appropriate (such as your project's Session.vim):
let g:hdevtools_options = '-g-isrc -g-Wall'
Make sure that each GHC option has its own -g prefix (don't group multiple
options like this: "-g-isrc\ -Wall")
Credits
Parts of the design of this plugin were inspired by
ghcmod-vim, and large amounts of
code were also taken.