nvim: Add some Haskell niceties

Some niceties taken from
http://silly-bytes.blogspot.com/2016/08/vim-haskell_11.html

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2020-01-27 20:59:02 +05:30
parent 14010c552e
commit a45c59d69c

View file

@ -397,6 +397,11 @@ augroup haskell_maps
au FileType haskell nmap <LocalLeader>c :HoogleClose<CR>
au FileType haskell nmap <LocalLeader>o :exe ':Hoogle ' . expand('<cword>')<CR>
au FileType haskell nmap <LocalLeader>i :exe ':HoogleInfo ' . expand('<cword>')<CR>
au FileType haskell nnoremap <buffer><silent> ]] :call JumpHaskellFunction(0)<CR>
au FileType haskell nnoremap <buffer><silent> [[ :call JumpHaskellFunction(1)<CR>
au FileType haskell inoremap <buffer> ;; <ESC>:call MakeArrow(1)<CR>
au FileType haskell inoremap <buffer> ;: <ESC>:call MakeArrow(0)<CR>
augroup END
augroup purescript_maps
@ -721,6 +726,28 @@ function! s:incsearch_config(...) abort
\ }), get(a:, 1, {}))
endfunction
function! JumpHaskellFunction(reverse)
call search('\C[[:alnum:]]*\s*::', a:reverse ? 'bW' : 'W')
endfunction
function! MakeArrow(type)
if a:type
if (matchstr(getline('.'), '\%' . col('.') . 'c.') ==? ' ')
exe "norm! a-> "
else
exe "norm! a -> "
endif
exe "startreplace"
else
if (matchstr(getline('.'), '\%' . col('.') . 'c.') ==? ' ')
exe "norm! a=> "
else
exe "norm! a => "
endif
exe "startreplace"
endif
endfunction
function! SetLspKeybindings()
nnoremap gd :call LanguageClient#textDocument_definition()<CR>
nnoremap gr :call LanguageClient#textDocument_rename()<CR>