|
| 1 | +hdevtools Vim Plugin |
| 2 | +==================== |
| 3 | + |
| 4 | +Vim plugin for Haskell development powered by the lightnight fast |
| 5 | +[hdevtools](<https://github.com/bitc/hdevtools/>) background server. |
| 6 | + |
| 7 | + |
| 8 | +About |
| 9 | +----- |
| 10 | + |
| 11 | +[hdevtools](<https://github.com/bitc/hdevtools/>) is a command line program |
| 12 | +powered by the GHC API, that provides services for Haskell development. |
| 13 | +hdevtools works by running a persistent process in the background, so that your |
| 14 | +Haskell modules remain in memory, instead of having to reload everything each |
| 15 | +time you change only one file. This is just like `:reload` in GHCi - with |
| 16 | +hdevtools you get the speed of GHCi as well as tight integration with your |
| 17 | +editor. |
| 18 | + |
| 19 | +This is the Vim plugin that integrates Vim with hdevtools. |
| 20 | + |
| 21 | + |
| 22 | +Installation |
| 23 | +------------ |
| 24 | + |
| 25 | +1. You must install the `hdevtools` command line program, It can be found |
| 26 | + here: <https://github.com/bitc/hdevtools/>, or from Hackage: |
| 27 | + |
| 28 | + $ cabal install hdevtools |
| 29 | + |
| 30 | +2. Install this plugin. [pathogen.vim](<https://github.com/tpope/vim-pathogen/>) |
| 31 | + is the recommended way: |
| 32 | + |
| 33 | + cd ~/.vim/bundle |
| 34 | + git clone https://github.com/bitc/hdevtools.git |
| 35 | + |
| 36 | +3. Configure your keybindings in your `.vimrc` file. I recommend something |
| 37 | + like: |
| 38 | + |
| 39 | + au FileType haskell nnoremap <buffer> <F1> :HdevtoolsType<CR> |
| 40 | + au FileType haskell nnoremap <buffer> <silent> <F2> :HdevtoolsClear<CR> |
| 41 | + |
| 42 | + |
| 43 | +Features |
| 44 | +-------- |
| 45 | + |
| 46 | +### Type Checking ### |
| 47 | + |
| 48 | +The best feature of the hdevtools command is near-instant checking of Haskell |
| 49 | +source files for errors - it's fast even for huge projects. |
| 50 | + |
| 51 | +This Vim plugin does not have direct support for interacting with this feature. |
| 52 | +Instead, I recommend using the excellent |
| 53 | +[Syntastic](<https://github.com/scrooloose/syntastic>) plugin. |
| 54 | + |
| 55 | +### Type Information ### |
| 56 | + |
| 57 | +Position the cursor anywhere in a Haskell source file, and execute |
| 58 | +`HdevtoolsType` (or press the `<F1>`) key if you have configured as above). |
| 59 | + |
| 60 | +The type for the expression under the cursor will be printed, and the |
| 61 | +expression will be highlighted. Repeated presses will expand the expression |
| 62 | +that is examined. |
| 63 | + |
| 64 | +You can execute `HdevtoolsClear` to get rid of the highlighting. |
| 65 | + |
| 66 | +Customization |
| 67 | +------------- |
| 68 | + |
| 69 | +You can set the `g:hdevtools_options` variable to pass custom options to |
| 70 | +hdevtools. |
| 71 | + |
| 72 | +This is useful for passing options through to GHC with the hdevtools `-g` |
| 73 | +flag. For example, if your project source code is in a `src` directory, |
| 74 | +and you want to use the GHC option `-Wall`, then stick the following somewhere |
| 75 | +appropriate (such as your project's `Session.vim`): |
| 76 | + |
| 77 | + let g:hdevtools_options = '-g-isrc -g-Wall' |
| 78 | + |
| 79 | +Make sure that each GHC option has its own `-g` prefix (don't group multiple |
| 80 | +options like this: `"-g-isrc\ -Wall"`) |
| 81 | + |
| 82 | + |
| 83 | +Credits |
| 84 | +------- |
| 85 | + |
| 86 | +Parts of the design of this plugin were inspired by |
| 87 | +[ghcmod-vim](<https://github.com/eagletmt/ghcmod-vim/>), and large amounts of |
| 88 | +code were also taken. |
0 commit comments