" coc.nvim nnoremap <silent> <leader>fi <Plug>(coc-fix-current) nnoremap <silent> <leader>gd <Plug>(coc-definition) nnoremap <silent> <leader>gt <Plug>(coc-type-definition) nnoremap <silent> <leader>sd <Plug>(coc-diagnostic-info) nnoremap <silent> <leader>gr <Plug>(coc-references) nnoremap <silent> K :call do#show_documentation()<CR> if has('nvim') " Make nvim :terminal more like vim :terminal tnoremap <C-w>N <C-\><C-n> endif " termdebug " TODO: Detecet if termdebug is loaded, if not do the default action. nnoremap <C-W><C-G> :Gdb<CR> nnoremap <C-W><C-E> :Program<CR> nnoremap <C-W><C-S> :Source<CR> tnoremap <C-G> :Gdb<CR> tnoremap <C-E> :Program<CR> tnoremap <C-S> :Source<CR> " GitGutter nnoremap <leader>gn :GitGutterNextHunk<CR> nnoremap <leader>gp :GitGutterPrevHunk<CR> " Quickfix list nnoremap <leader>qo :copen<CR> nnoremap <leader>qc :cclose<CR> nnoremap <leader>qq :cc<CR> nnoremap <leader>qn :cnext<CR> nnoremap <leader>qp :cprevious<CR> nnoremap <leader>qf :cfirst<CR> nnoremap <leader>qa :clast<CR> " Location list nnoremap <leader>lo :lopen<CR> nnoremap <leader>lc :lclose<CR> nnoremap <leader>ll :ll<CR> nnoremap <leader>ln :lnext<CR> nnoremap <leader>lp :lprevious<CR> nnoremap <leader>lf :lfirst<CR> nnoremap <leader>la :llast<CR> " Preview window nnoremap <leader>pc :pclose<CR> nnoremap <leader>pe :pedit<Space> nnoremap <leader>ps :psearch<Space> " fzf nnoremap <C-f>f :Files<Space> nnoremap <C-f>a :Ag<Space> nnoremap <C-f>g :GitFiles<CR> nnoremap <C-f>b :Buffers<CR> nnoremap <C-f>l :BLines<CR> nnoremap <C-f>c :Colors<CR> nnoremap <C-f>h :Helptags<CR> nnoremap <C-f>s :Snippets<CR> " Search to the word under the cursor nnoremap <leader>ag :Ag <C-R>=expand('<cword>')<CR><CR> " Treat long lines as line containing breaks nnoremap j gj nnoremap k gk " Quick write nnoremap <leader>w :w!<CR> " Switch panes in a tmux aware way nnoremap <silent> <C-h> :TmuxNavigateLeft<CR> nnoremap <silent> <C-j> :TmuxNavigateDown<CR> nnoremap <silent> <C-k> :TmuxNavigateUp<CR> nnoremap <silent> <C-l> :TmuxNavigateRight<CR> nnoremap <silent> <C-w>h :TmuxNavigateLeft<CR> nnoremap <silent> <C-w>j :TmuxNavigateDown<CR> nnoremap <silent> <C-w>k :TmuxNavigateUp<CR> nnoremap <silent> <C-w>l :TmuxNavigateRight<CR> if has('nvim') tnoremap <silent> <C-w>h <C-\><C-n>:TmuxNavigateLeft<CR> tnoremap <silent> <C-w>j <C-\><C-n>:TmuxNavigateDown<CR> tnoremap <silent> <C-w>k <C-\><C-n>:TmuxNavigateUp<CR> tnoremap <silent> <C-w>l <C-\><C-n>:TmuxNavigateRight<CR> else tnoremap <silent> <C-w>h <C-w>N:TmuxNavigateLeft<CR> tnoremap <silent> <C-w>j <C-w>N:TmuxNavigateDown<CR> tnoremap <silent> <C-w>k <C-w>N:TmuxNavigateUp<CR> tnoremap <silent> <C-w>l <C-w>N:TmuxNavigateRight<CR> endif " Quick tabs nnoremap <leader>tn :tabnew<Space> nnoremap <leader>tc :tabclose<CR> nnoremap <leader>to :tabonly<CR> nnoremap <leader>tm :tabmove<Space> " Clear search highlights nnoremap <leader><Space> :nohlsearch<CR> if tmux#isOption('set-clipboard', 'on') || $SSH_CONNECTION !=# '' " When connected to a remote session the + selection register is not " available and the unnamed register is used instead. Add mappings using the " z register instead. noremap <leader>y "zy noremap <leader>Y "zY " Enable OSC 52 copy on yank. call osc52#autocmd() else " System clipboard yank/put noremap <leader>y "+y noremap <leader>Y "+Y noremap <leader>p "+p noremap <leader>P "+P endif " Quickly access spelling menu inoremap <C-s> <C-g>u<C-X>s nnoremap <C-s> i<C-g>u<C-X>s " Disable 'Q' from opening Ex mode nnoremap Q <nop> " Split line at the cursor nnoremap [j i<CR><Esc> nnoremap ]j a<CR><Esc> " Toggle Checkbox nnoremap <leader><CR> :ToggleCheckbox<CR> " Show highlight groups under the cursor nnoremap <leader>hi :CursorHighlightGroups<CR> " Rename C/C++ include guard nnoremap <leader>rg :call do#rename_include_guard(expand('<cword>'))<cr>