vim-config/after/ftplugin/haskell.vim
2022-07-28 00:13:09 +08:00

49 lines
1.2 KiB
VimL

setlocal ts=2 sw=2 expandtab
" tags
call CmdAlias('hasktags', '!hasktags -c .<CR>')
" from
" https://raw.githubusercontent.com/begriffs/haskell-vim-now/master/git-hscope
call CmdAlias('codex', 'call system("haskell-ctags")<CR><CR>call LoadHscope()<CR>')
call CmdAlias('Cc', 'Clap commits<CR>')
map <leader>ctg :codex<CR>
set tags=tags;/,codex.tags;/
" nnoremap <silent> <leader>cgd :cs find g <C-R>=expand("<cword>")<CR><CR>
nnoremap <silent> <C-\> :cs find c <C-R>=expand("<cword>")<CR><CR>
" set cscopeprg=do_at_stack_root\ hscope
set csre
set csto=1 " search codex tags first
set nocst
" set cscopequickfix=s-,c-,d-,i-,t-,e-,a-
function! LoadHscope()
set nocscopeverbose " suppress 'duplicate connection' error
let hsf = findfile("hscope.out", ".;")
if filereadable(hsf)
exe "cs add " . hsf
elseif $HSCOPE_DB != ""
cs add $HSCOPE_DB
endif
set cscopeverbose
endfunction
" au BufEnter /*.hs call LoadHscope()
call deoplete#enable()
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
" vim-lsp
if executable('haskell-language-server-wrapper')
au User lsp_setup call lsp#register_server({
\ 'name': 'hls',
\ 'cmd': {server_info->['haskell-language-server-wrapper', '--lsp']},
\ 'allowlist': ['haskell'],
\ })
endif