" Convience - configs & mappings to smooth out rough edges and make vim feel like home " Move between wrapped lines, rather than jumping over wrapped segments nmap j gj nmap k gk " Use C-Space to Esc out of any mode nnoremap :noh vnoremap gV onoremap cnoremap inoremap " Terminal sees as nnoremap :noh vnoremap gV onoremap cnoremap inoremap nnoremap cc :ClearEmAll command! ClearEmAll call s:ClearEmAll() function! s:ClearEmAll() nohlsearch cclose pclose lclose " call coc#util#float_hide() call popup_clear() endfunction " Quick sourcing of the current file, allowing for quick vimrc testing nnoremap sop :source % nnoremap df :Files ~/code/dotfiles nnoremap ; : nmap bi :PlugInstall " Q for Ex mode is useless. This will run the macro in q register nnoremap Q @q " Swap 0 and ^. I tend to want to jump to the first non-whitespace character " so make that the easier one to do. nnoremap 0 ^ nnoremap ^ 0 augroup vimrcEx autocmd! " When editing a file, always jump to the last known cursor position. " Don't do it for commit messages, when the position is invalid, or when " inside an event handler (happens when dropping a file on gvim). autocmd BufReadPost * \ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif augroup END " Switch between the last two files nnoremap " vim:ft=vim