let mapleader = "," set hidden " disable mouse set mouse= " GoTo code navigation. nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) " Rename nmap rn (coc-rename) " Use K to show documentation in preview window. nnoremap K :call ShowDocumentation() nmap ac (coc-codeaction) nmap as (coc-codeaction-cursor) nmap cl (coc-codelens-action) nmap [G (coc-diagnostic-next-error) nmap ]G (coc-diagnostic-prev-error) nmap [g (coc-diagnostic-next) nmap ]g (coc-diagnostic-prev) " NERDTree config " autocmd VimEnter * NERDTree autocmd BufEnter * NERDTreeMirror "CTRL-t to toggle tree view with CTRL-t nmap :NERDTreeToggle "Set F2 to put the cursor to the nerdtree nmap :NERDTreeFind function! ShowDocumentation() if CocAction('hasProvider', 'hover') call CocActionAsync('doHover') else call feedkeys('K', 'in') endif endfunction " Highlight the symbol and its references when holding the cursor. autocmd CursorHold * silent call CocActionAsync('highlight') " Formatting selected code. xmap f (coc-format-selected) nmap f (coc-format-selected) nmap F (coc-format) " " Copy to clipboard vnoremap y "+y nnoremap Y "+yg_ nnoremap y "+y nnoremap yy "+yy " " Paste from clipboard nnoremap p "+p nnoremap P "+P vnoremap p "+p vnoremap P "+P " " Tabbing https://webdevetc.com/blog/tabs-in-vim/ map tn :tabnew map t :tabnext map tm :tabmove map tc :tabclose map to :tabonly " Display line numbers set number relativenumber inoremap coc#pum#visible() ? coc#_select_confirm() \: "\u\\=coc#on_enter()\" map :mksession! .nvim_session " Quick write session with F3 map :source .nvim_session " And load session with F4 set undofile set undodir=~/.vim/undodir " Remember last posistion " split-term-vim let g:split_term_default_shell = "fish" set splitright " Airline let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#show_tab_nr = 1 let g:airline#extensions#tabline#tab_nr_type = 1 " DAP nnoremap lua require'dap'.continue() nnoremap lua require'dap'.step_over() nnoremap lua require'dap'.step_into() nnoremap lua require'dap'.step_out() nnoremap b lua require'dap'.toggle_breakpoint() nnoremap B lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: ')) nnoremap lp lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) nnoremap dr lua require'dap'.repl.open() nnoremap dl lua require'dap'.run_last() if has("autocmd") au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif endif