" No arrow keys noremap noremap noremap noremap inoremap inoremap inoremap inoremap " Quick window switching " Ctrl-[hjkl] nnoremap h nnoremap j nnoremap k nnoremap l " Distraction free typing " l - Toggle Goyo and Limelight nnoremap l :Goyo autocmd! User GoyoEnter Limelight autocmd! User GoyoLeave Limelight! " fzf " p - Search files in current workdir " P - Search files in $HOME " g - Search commits for current buffer " G - Search commits in current workdir " f - Search source in current workdir " ; - Search buffers nnoremap p :Files nnoremap P :Files ~ nnoremap g :BCommits nnoremap G :Commits nnoremap f :Rg nnoremap ; :Buffers " NERDTree " e - Toggle NERDTree on/off " E - Open current file location in NERDTree nnoremap e :NERDTreeToggle nnoremap E :NERDTreeFind " coc.nvim " Ctrl-n - Go to previous diagnostic " Ctrl-p - Go to next diagnostic " d - Jump to definition of current symbol " r - Jump to references of current symbol " j - Jump to implementation of current symbol " s - Fuzzy search current project symbols " n - Symbol renaming " y - Format selected code nnoremap (coc-diagnostic-prev) nnoremap (coc-diagnostic-next) nnoremap d (coc-definition) nnoremap r (coc-references) nnoremap j (coc-implementation) nnoremap s :CocList -I -N --top symbols nnoremap n (coc-rename) nnoremap y (coc-format-selected) " Search shorcuts " h - Find and replace " / - Clear highlighted search terms while preserving history nnoremap h :%s/// nnoremap / :nohlsearch " Easy-motion shortcut " w - move to word bi-directionally " W{char} - move to {char} nnoremap w (easymotion-bd-w) nnoremap W (easymotion-bd-f) " use for trigger completion and navigate to next complete item inoremap \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ coc#refresh() inoremap pumvisible() ? "\" : "\" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~ '\s' endfunction " Use to trigger completion. if has('nvim') inoremap coc#refresh() else inoremap coc#refresh() endif " Use K to show documentation in preview window. nnoremap K :call show_documentation() function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') elseif (coc#rpc#ready()) call CocActionAsync('doHover') else execute '!' . &keywordprg . " " . expand('') endif endfunction " Highlight the symbol and its references when holding the cursor. autocmd CursorHold * silent call CocActionAsync('highlight') augroup mygroup autocmd! " Setup formatexpr specified filetype(s). autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') " Update signature help on jump placeholder. autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') augroup end