vimrc/mapping.vim

39 lines
1.9 KiB
VimL

" quickly clear Syntastic info
nmap <F4> :SyntasticReset<CR>
" toggle gundo's display
nmap <F5> :UndotreeToggle<CR>
" quickly toggle a right, vsplit for viewing, navigating whatever structure easy
" tags/tagbar can figure out for the current buffer
nmap <F9> :TagbarToggle<CR>
" quickly toggle a left, vsplit for an insanely powerful file explorer
nmap <F8> :NERDTreeToggle<CR>
" open tree to current buffer
nmap <S-F8> :NERDTreeFind<CR>
" use similar key, esc, to exit terminal mode
tnoremap <C-Space><Esc> <C-\><C-n>
" from: https://sharksforarms.dev/posts/neovim-rust/
" Code navigation shortcuts
nnoremap <silent> <c-]> <cmd>lua vim.lsp.buf.definition()<CR>
nnoremap <silent> K <cmd>lua vim.lsp.buf.hover()<CR>
nnoremap <silent> gD <cmd>lua vim.lsp.buf.implementation()<CR>
nnoremap <silent> <c-k> <cmd>lua vim.lsp.buf.signature_help()<CR>
nnoremap <silent> 1gD <cmd>lua vim.lsp.buf.type_definition()<CR>
nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>
nnoremap <silent> g0 <cmd>lua vim.lsp.buf.document_symbol()<CR>
nnoremap <silent> gW <cmd>lua vim.lsp.buf.workspace_symbol()<CR>
nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>
nnoremap <silent> ga <cmd>lua vim.lsp.buf.code_action()<CR>
nnoremap <silent> <Leader>rn <cmd>lua vim.lsp.buf.rename()<CR>
" Goto previous/next diagnostic warning/error
nnoremap <silent> g[ <cmd>lua vim.diagnostic.goto_prev()<CR>
nnoremap <silent> g] <cmd>lua vim.diagnostic.goto_next()<CR>
nnoremap <silent> gE <cmd>lua vim.diagnostic.setloclist()<CR>
" work with Trouble to view lists of diagnostic warnings/ennoremap <leader>xx <cmd>TroubleToggle<cr>
nnoremap <leader>xw <cmd>TroubleToggle workspace_diagnostics<cr>
nnoremap <leader>xd <cmd>TroubleToggle document_diagnostics<cr>
nnoremap <leader>xq <cmd>TroubleToggle quickfix<cr>
nnoremap <leader>xl <cmd>TroubleToggle loclist<cr>
nnoremap gR <cmd>TroubleToggle lsp_references<cr>rrors