nvim: Use a custom stack compiler for Haskell
Neovim has a "stack" compiler file but this does not seem to work, at least not in the shitty monorepo I am working on. Someone provided a solution on Reddit which uses a custom compiler file and has been modified to work on modules. Which is also perhaps why it doesn't work in the monorepo project at work. https://www.reddit.com/r/neovim/comments/es8wn7/haskell_makeprg_for_stack_build/ https://github.com/maxigit/vimrc/tree/2020/compiler Use them and tie it up with Neomake! change. Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
f7d7f6a328
commit
a5792a3f3a
3 changed files with 67 additions and 1 deletions
20
nvim/.config/nvim/compiler/ghci.vim
Normal file
20
nvim/.config/nvim/compiler/ghci.vim
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
" Vim compiler file
|
||||||
|
" Compiler: Haskell repl - ghci
|
||||||
|
" Author: Maxime Bourget
|
||||||
|
|
||||||
|
if exists("current_compiler")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let current_compiler="ghci"
|
||||||
|
" inherit from stack settings
|
||||||
|
" compiler stack
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
CompilerSet makeprg=stack\ repl
|
||||||
|
|
||||||
|
CompilerSet errorformat+=%f:%.%l%.%c%.%#
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
42
nvim/.config/nvim/compiler/stack.vim
Normal file
42
nvim/.config/nvim/compiler/stack.vim
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
" Vim compiler file
|
||||||
|
" Compiler: Haskell Stack
|
||||||
|
" Maintainer: Daniel Campoverde <alx@sillybytes.net>
|
||||||
|
" Latest Revision: 2018-08-27
|
||||||
|
|
||||||
|
if exists("current_compiler")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let current_compiler = "stack"
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
|
||||||
|
CompilerSet errorformat=
|
||||||
|
\%-G%.%#:\ build\ %.%#,
|
||||||
|
\%-G%.%#:\ configure\ %.%#,
|
||||||
|
\%-G[%.%#]%.%#,
|
||||||
|
\%-G%.%#preprocessing\ %.%#,
|
||||||
|
\%-G%.%#configuring\ %.%#,
|
||||||
|
\%-G%.%#building\ %.%#,
|
||||||
|
\%-G%.%#linking\ %.%#,
|
||||||
|
\%-G%.%#installing\ %.%#,
|
||||||
|
\%-G%.%#registering\ %.%#,
|
||||||
|
\%-G%.%#:\ copy/register%.%#,
|
||||||
|
\%-G%.%#process\ exited\ %.%#,
|
||||||
|
\%-G%.%#--builddir=%.%#,
|
||||||
|
\%-G--%.%#,
|
||||||
|
\%-G%.%#\|%.%#,
|
||||||
|
\%E%o\ %#>%f:%l:%c:\ error:,%+Z\ \ \ \ %m,
|
||||||
|
\%E%o\ %#>%f:%l:%c:\ error:\ %m,%-Z,
|
||||||
|
\%W%o\ %#>%f:%l:%c:\ warning:,%+Z\ \ \ \ %m,
|
||||||
|
\%W%o\ %#>%f:%l:%c:\ warning:\ %m,%-Z,
|
||||||
|
\%E%f:%l:%c:\ error:,%+Z\ \ \ \ %m,
|
||||||
|
\%E%f:%l:%c:\ error:\ %m,%-Z,
|
||||||
|
\%W%f:%l:%c:\ warning:,%+Z\ \ \ \ %m,
|
||||||
|
\%W%f:%l:%c:\ warning:\ %m,%-Z,
|
||||||
|
|
||||||
|
CompilerSet makeprg=stack\ --no-terminal
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
|
@ -386,7 +386,11 @@ augroup END
|
||||||
|
|
||||||
augroup haskell_maps
|
augroup haskell_maps
|
||||||
au!
|
au!
|
||||||
au FileType haskell nmap <LocalLeader>b :NeomakeSh stack build<CR>
|
" https://www.reddit.com/r/neovim/comments/es8wn7/haskell_makeprg_for_stack_build/
|
||||||
|
" https://github.com/maxigit/vimrc/tree/2020/compiler
|
||||||
|
au FileType haskell compiler stack
|
||||||
|
au FileType haskell setlocal makeprg=stack\ build
|
||||||
|
au FileType haskell nmap <LocalLeader>b :Neomake!<CR>
|
||||||
au FileType haskell nmap <LocalLeader>t :NeomakeSh stack exec -- hasktags -x -c .<CR>
|
au FileType haskell nmap <LocalLeader>t :NeomakeSh stack exec -- hasktags -x -c .<CR>
|
||||||
au FileType haskell nmap <LocalLeader>g :Ghcid<CR>
|
au FileType haskell nmap <LocalLeader>g :Ghcid<CR>
|
||||||
au FileType haskell nmap <LocalLeader>k :GhcidKill<CR>
|
au FileType haskell nmap <LocalLeader>k :GhcidKill<CR>
|
||||||
|
|
Loading…
Reference in a new issue