ghcmod-vim

所属分类:collect
开发工具:Vim Script
文件大小:0KB
下载次数:0
上传日期:2018-08-30 19:08:46
上 传 者sh-1993
说明:  Happy Haskell在Vim上编程,由ghc mod提供支持,
(Happy Haskell programming on Vim, powered by ghc-mod,)

文件列表:
.travis.yml (293, 2016-06-19)
CONTRIBUTING.md (645, 2016-06-19)
ChangeLog.md (3049, 2016-06-19)
after/ (0, 2016-06-19)
after/ftplugin/ (0, 2016-06-19)
after/ftplugin/haskell/ (0, 2016-06-19)
after/ftplugin/haskell/ghcmod.vim (2726, 2016-06-19)
after/ftplugin/lhaskell/ (0, 2016-06-19)
after/ftplugin/lhaskell/ghcmod.vim (21, 2016-06-19)
autoload/ (0, 2016-06-19)
autoload/ghcmod.vim (10928, 2016-06-19)
autoload/ghcmod/ (0, 2016-06-19)
autoload/ghcmod/async.vim (1313, 2016-06-19)
autoload/ghcmod/command.vim (6988, 2016-06-19)
autoload/ghcmod/diagnostics.vim (1413, 2016-06-19)
autoload/ghcmod/type.vim (1761, 2016-06-19)
autoload/ghcmod/util.vim (3417, 2016-06-19)
dist.sh (113, 2016-06-19)
dist.vim (180, 2016-06-19)
doc/ (0, 2016-06-19)
doc/ghcmod.txt (8911, 2016-06-19)
install-deps.sh (360, 2016-06-19)
plugin/ (0, 2016-06-19)
plugin/ghcmod.vim (69, 2016-06-19)
test.sh (362, 2016-06-19)
test/ (0, 2016-06-19)
test/before.vim (415, 2016-06-19)
test/data/ (0, 2016-06-19)
test/data/detect_module/ (0, 2016-06-19)
test/data/detect_module/Foo.hs (44, 2016-06-19)
test/data/detect_module/ModuleDeclInComment.hs (263, 2016-06-19)
test/data/detect_module/ModuleWithSpace.hs (85, 2016-06-19)
test/data/detect_module/NoModuleDecl.hs (31, 2016-06-19)
test/data/detect_module/Normal.hs (20, 2016-06-19)
test/data/failure/ (0, 2016-06-19)
test/data/failure/Main.hs (62, 2016-06-19)
test/data/failure/SyntaxError.hs (52, 2016-06-19)
test/data/sig/ (0, 2016-06-19)
... ...

# ghcmod.vim [![Build Status](https://api.travis-ci.org/eagletmt/ghcmod-vim.svg)](https://travis-ci.org/eagletmt/ghcmod-vim) [![Gitter chat](https://badges.gitter.im/eagletmt/ghcmod-vim.png)](https://gitter.im/eagletmt/ghcmod-vim) Happy Haskell programming on Vim, powered by [ghc-mod](https://github.com/kazu-yamamoto/ghc-mod) - [http://www.vim.org/scripts/script.php?script\_id=4473](http://www.vim.org/scripts/script.php?script_id=4473) - https://github.com/eagletmt/ghcmod-vim/releases ## Features - Displaying the type of sub-expressions (`ghc-mod type`) - Displaying error/warning messages and their locations (`ghc-mod check` and `ghc-mod lint`) - Displaying the expansion of splices (`ghc-mod expand`) - Insert split function cases (`ghc-mod split`) Completions are supported by another plugin. See [neco-ghc](https://github.com/eagletmt/neco-ghc) . ## Requirements ### Vim ghcmod.vim contains ftplugin. Please make sure that filetype plugin is enabled. To check it, type `:filetype` and you would see something like this: `filetype detection:ON plugin:ON indent:ON`. You can enable it by `:filetype plugin on`. I highly recommend adding `filetype plugin indent on` to your vimrc. See `:help :filetype-overview` for more details. ### vimproc https://github.com/Shougo/vimproc ### ghc-mod >= 5.0.0 ```sh cabal install ghc-mod ``` ## Details If you'd like to give GHC options, set `g:ghcmod_ghc_options`. ```vim let g:ghcmod_ghc_options = ['-idir1', '-idir2'] ``` Also, there's buffer-local version `b:ghcmod_ghc_options`. ```vim autocmd BufRead,BufNewFile ~/.xmonad/* call s:add_xmonad_path() function! s:add_xmonad_path() if !exists('b:ghcmod_ghc_options') let b:ghcmod_ghc_options = [] endif call add(b:ghcmod_ghc_options, '-i' . expand('~/.xmonad/lib')) endfunction ``` ### :GhcModType, :GhcModTypeClear Type `:GhcModType` on a expression, then the sub-expression is highlighted and its type is echoed. If you type `:GhcModType` multiple times, the sub-expression changes. 1. ![type1](http://cache.gyazo.com/361ad3652a412f780106ab07ad11f206.png) 2. ![type2](http://cache.gyazo.com/0c884849a971e367c75a6ba68bed0157.png) 3. ![type3](http://cache.gyazo.com/3644d66a3c5fbc51c01b5bb2053864cd.png) 4. ![type4](http://cache.gyazo.com/ece85e8a1250bebfd13208a63679a3db.png) 5. ![type5](http://cache.gyazo.com/71e4c79f9b42faaaf81b4e3695fb4d7f.png) Since ghc-mod 1.10.8, not only sub-expressions but name bindings and sub-patterns are supported. - ![type-bind](http://cache.gyazo.com/cee203adbf715f00d2dbd82c5cff3eaa.png) - ![type-pat](http://cache.gyazo.com/7a22068b73442e8447a4081d5ddffd31.png) Type `:GhcModTypeClear` to clear sub-expression's highlight. Sub-expressions are highlighted as `Search` by default. You can customize it by setting `g:ghcmod_type_highlight` . ```vim hi ghcmodType ctermbg=yellow let g:ghcmod_type_highlight = 'ghcmodType' ``` ### :GhcModCheck, :GhcModLint You can get compiler errors/warnings by `:GhcModCheck` and they are available in quickfix window. ![check](http://cache.gyazo.com/c09399b2fe370ce9d328b8ed12118de8.png) Similarly, type `:GhcModLint` to get suggestions by `ghc-mod lint`. If you'd like to pass options to hlint, set `g:ghcmod_hlint_options`. ```vim let g:ghcmod_hlint_options = ['--ignore=Redundant $'] ``` ![lint](http://cache.gyazo.com/3b64724ce2587e03761fe618457f1c2e.png) If you'd like to open in another way the quickfix, set `g:ghcmod_open_quickfix_function`. ```vim let g:ghcmod_open_quickfix_function = 'GhcModQuickFix' function! GhcModQuickFix() " for unite.vim and unite-quickfix :Unite -no-empty quickfix " for ctrlp ":CtrlPQuickfix " for FuzzyFinder ":FufQuickfix endfunction ``` ### :GhcModCheckAsync, :GhcModLintAsync, :GhcModCheckAndLintAsync You can run check and/or lint asynchronously. This would be useful when you'd like to run check and/or lint automatically (especially on `BufWritePost`). See Customize wiki page for more detail. ### :GhcModExpand You can see the expansion of splices by `:GhcModExpand` and they are available in quickfix window. ![expand](http://cache.gyazo.com/bcbee2b84f956a87b636a67b5d5af488.png) This feature was introduced since ghc-mod 1.10.10. ### GhcModSplitFunCase Split the function case by examining a type's constructors. ```haskell f :: [a] -> a f x = _body ``` When you type `:GhcModSplitFunCase` at the `x` position, ghcmod-vim will replace it with: ```haskell f :: [a] -> a f [] = _body f (x:xs) = _body ``` ### GhcModSigCodegen Insert initial code from the given signature. ```haskell func :: [a] -> Maybe b -> (a -> b) -> (a,b) ``` ghcmod-vim will insert initial code using typed holes. ```haskell func x y z f = _func_body ``` Instance declarations are also supported. ```haskell newtype D = D (Int,String) class C a where cInt :: a -> Int cString :: a -> String instance C D where ``` ghcmod-vim will insert: ```haskell cInt x = _cInt_body cString x = _cString_body ``` ## Customize See wiki page [Customize](https://github.com/eagletmt/ghcmod-vim/wiki/Customize). ## License [BSD3 License](http://www.opensource.org/licenses/BSD-3-Clause), the same license as ghc-mod. Copyright (c) 2012-2013, eagletmt

近期下载者

相关文件


收藏者