THIS FORK HAS BEEN INTEGRATED BACK INTO ITS UPSTREAM AND IS NO LONGER MAINTAINED!
If you are using this plugin since before the deprecation, it's recommended you switch over to https://github.com/parsonsmatt/intero-neovim. It now has support for using any GHCi as a backend, the primary feature of this plugin when it was forked. Thanks for your usage and support!
Interactive Haskell development using GHCi in Neovim
This is a fork of intero-neovim that uses regular GHCi, instead of
intero. It has fewer features than its Intero counterpart, but does not rely
on Stack and Intero.
Some key features:
This plugin reports errors and warnings as you work on your file using the Neomake plugin. Errors appear asynchronously, and don't block the UI.
Work with your Haskell code directly in GHCi using Neovim
:terminalbuffers. Load your file and play around with top-level functions directly.
This plugin is compatible with
vim-plug, etc. For example:
- To open the REPL:
- To load into the REPL:
- To reload whatever's in the REPL:
- To evaluate an expression from outside the REPL:
:GhciEvaluate <expression>, or
:GhciEvaluate, and then enter the expression in the prompt.
Complete usage and configuration information can be found in here:
These are some suggested settings. This plugin sets up no keybindings by default.
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 <silent> <leader>gs :GhciStart<CR> au FileType haskell nnoremap <silent> <leader>gk :GhciKill<CR> " Restarting GHCi might be required if you add new dependencies au FileType haskell nnoremap <silent> <leader>gr :GhciRestart<CR> " Open GHCi split horizontally au FileType haskell nnoremap <silent> <leader>go :GhciOpen<CR> " Open GHCi split vertically au FileType haskell nnoremap <silent> <leader>gov :GhciOpen<CR><C-W>H au FileType haskell nnoremap <silent> <leader>gh :GhciHide<CR> " RELOADING (PICK ONE): " Automatically reload on save au BufWritePost *.hs GhciReload " Manually save and reload au FileType haskell nnoremap <silent> <leader>wr :w \| :GhciReload<CR> " Load individual modules au FileType haskell nnoremap <silent> <leader>gl :GhciLoadCurrentModule<CR> au FileType haskell nnoremap <silent> <leader>gf :GhciLoadCurrentFile<CR> augroup END " 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 = 'cabal new-repl' let g:ghci_command_line_options = '-fobject-code'
Using the Stack REPL
If you'd like to use
stack repl, instead of plain
cabal repl, you
can use something like the following configuration:
let g:ghci_command = 'stack repl' let g:ghci_command_line_options = '--ghci-options="-fobject-code"'
Using a project specific .nvim.rc, you can also customize the Stack targets for the GHCi session of particular projects:
let g:ghci_command = 'stack repl my-project:test:my-test-suite'
:Neomake!directly will not work. You need to run
Some commands may have unexpected side-effects if you have an autocommand that automatically switches to insert mode when entering a terminal buffer.
This project welcomes new contributions! Submit pull requests and open issues on GitHub: https://github.com/owickstrom/neovim-ghci