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:
parent
14010c552e
commit
a45c59d69c
1 changed files with 27 additions and 0 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue