diff --git a/nvim/init.vim b/nvim/init.vim index 71f8c38..b9a234d 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -52,6 +52,7 @@ Plug 'Olical/vim-scheme', { 'for': 'scheme', 'on': 'SchemeConnect' } " Haskell Plug 'ekmett/haskell-vim', { 'for': [ 'haskell', 'cabal' ] } Plug 'neomake/neomake' +Plug 'SanchayanMaity/neovim-ghci' " For Nix Plug 'LnL7/vim-nix', { 'for': 'nix' } " For autocompletion @@ -217,6 +218,34 @@ noremap noremap noremap +augroup ghciMaps + au! + " Maps for ghci. Restrict to Haskell buffers so the bindings don't collide. + + " Background process and window management + au FileType haskell nnoremap is :GhciStart + au FileType haskell nnoremap ik :GhciKill + + " Restarting GHCi might be required if you addinew dependencies + au FileType haskell nnoremap ir :GhciRestart + + " Open GHCi split horizontally + au FileType haskell nnoremap io :GhciOpen + " Open GHCi split vertically + au FileType haskell nnoremap iov :GhciOpenH + au FileType haskell nnoremap ih :GhciHide + + au FileType haskell nnoremap it :GhciType + au FileType haskell nnoremap ii :GhciInfo + au FileType haskell nnoremap ie :GhciEval + " Manually save and reload + au FileType haskell nnoremap ir :w \| :GhciReload + + " Load individual modules + au FileType haskell nnoremap il :GhciLoadCurrentModule + au FileType haskell nnoremap if :GhciLoadCurrentFile +augroup END + augroup deopleteMaps au! " For deoplete Rust @@ -260,6 +289,14 @@ let g:haskell_indent_guard = 2 let g:haskell_indent_case_alternative = 1 let g:cabal_indent_section = 2 +" GHCi starts automatically. Set this if you'd like to prevent that. +let g:ghci_start_immediately = 0 + +" Customize how to run GHCi +let g:ghci_command = 'stack repl' +let g:ghci_command_line_options = '--ghci-options="-fobject-code"' +let g:ghci_use_neomake = 1 + " Use deoplete let g:deoplete#enable_at_startup = 1 " Disable autocomplete by default