Skip to content

Commit

Permalink
Enable keys for coc.nvim refactoring and add node-inspector binds
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmmendes committed Oct 23, 2020
1 parent 6bae61c commit 93e9c84
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions keys.vim
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,39 @@ function! s:cocActionsOpenFromSelected(type) abort
endfunction
xmap <silent> <leader>a :<C-u>execute 'CocCommand actions.open ' . visualmode()<CR>
nmap <silent> <leader>a :<C-u>set operatorfunc=<SID>cocActionsOpenFromSelected<CR>g@
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Remap for rename current word
nmap <F2> <Plug>(coc-rename)
" Remap for format selected region
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected
" Use K to show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>
" use `:OR` for organize import of current buffer
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')

function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction

" Node Inspector Keys
nnoremap <silent><F4> :NodeInspectStart<cr>
nnoremap <silent><F5> :NodeInspectRun<cr>
nnoremap <silent><F6> :NodeInspectConnect("127.0.0.1:9229")<cr>
nnoremap <silent><F7> :NodeInspectStepInto<cr>
nnoremap <silent><F8> :NodeInspectStepOver<cr>
nnoremap <silent><F9> :NodeInspectToggleBreakpoint<cr>
nnoremap <silent><F10> :NodeInspectStop<cr>

0 comments on commit 93e9c84

Please sign in to comment.