diff --git a/.config/vim/vimrc.d/40-keys.vim b/.config/vim/vimrc.d/40-keys.vim index 51dc9be..e37f89f 100644 --- a/.config/vim/vimrc.d/40-keys.vim +++ b/.config/vim/vimrc.d/40-keys.vim @@ -9,8 +9,8 @@ nnoremap :nohlsearch " Split view navigation " Create new panes -nnoremap N :vsplit -nnoremap n :split +nnoremap N vsplit +nnoremap n split " Substitute command if (exists('+inccommand') && &inccommand != '') @@ -56,8 +56,8 @@ function! CycleSpellLang() endif endfunction " Toggle spell, cycle and set spelllang -map st :set spell=!&spell -map sc :call CycleSpellLang() +map st set spell=!&spell +map sc call CycleSpellLang() map ss :set spelllang= " Jump through jump table but center @@ -71,19 +71,19 @@ if (has('nvim')) nmap :split +terminali nmap v :vsplit +terminali elseif (has('terminal')) - nmap :terminal + nmap terminal endif " Plugin specific bindings if (get(g:, 'loaded_fzf')) - nmap f :Files - nmap j :Lines - nmap / :Lines - nmap h :Helptags + nmap f Files + nmap j Lines + nmap / Lines + nmap h Helptags " TODO: fix this? if (get(g:, 'loaded_gutentags') || 1) - nmap t :Tags - nmap bt :BTags + nmap t Tags + nmap bt BTags endif endif @@ -129,26 +129,26 @@ nmap grc :let subject=system('git show -s --format="(\"%s\")" nmap gso :r!git config --get user.name:r!git config --get user.emailI<A>kJISigned-off-by: " Add, stash or checkout the current file -nmap ga :!git add -- % -nmap gs :!git stash -- % -nmap gu :!git checkout -- % +nmap ga !git add -- % +nmap gs !git stash -- % +nmap gu !git checkout -- % if exists('g:loaded_fugitive') " Interactive `git status` - nmap gg :G + nmap gg G " Start a commit and open the message in a split - nmap gcc :G commit + nmap gcc G commit " Amend the current commit and open the message in a split - nmap gca :G commit --amend + nmap gca G commit --amend " Move to root of directory - nmap gcd :Gcd + nmap gcd Gcd " git blame in scroll bound vertical split (only the commit hashes, see " :help :Git_blame) nmap gb :G blameC else " Move to root of directory " NOTE: only works if a file is already opened - nnoremap gcd :cd %:h cd `git rev-parse --show-toplevel` + nnoremap gcd cd %:h cd `git rev-parse --show-toplevel` endif if exists('g:loaded_gitgutter') @@ -175,10 +175,10 @@ endif if (get(g:, 'loaded_fzf')) " git files that `git status` lists - nmap gf :GFiles? + nmap gf GFiles? " 'git log (log?)' and 'git log buffer ' - map gll :Commits - map glb :BCommits + map gll Commits + map glb BCommits endif " Y should behave like D & C does @@ -188,8 +188,8 @@ nnoremap Y y$ nmap dd 0D " Fix & command to also use last flags -nnoremap & :&& -xnoremap & :&& +nnoremap & && +xnoremap & && " see :help i_ctrl-g_u " Do not break undo sequence when using the arrow keys or home and end in insert @@ -253,7 +253,7 @@ augroup END " Convert Unix timestamp to human readable " Mnemonic: "Unix timestamp convert" with pun to UTC nnoremap utc ciw=strftime("%F %T", @") -vnoremap utc :s/\v(^\|[^0-9])\zs[0-9]{10}\ze([^0-9]\|$)/\=strftime("%F %T",submatch(0))/g +vnoremap utc s/\v(^\|[^0-9])\zs[0-9]{10}\ze([^0-9]\|$)/\=strftime("%F %T",submatch(0))/g " Match the behaviour of [[ and []. ]] forward to next '}' in the first column " and ][ fw to next '[', instead of the other way around. @@ -261,13 +261,13 @@ noremap ]] ][ noremap ][ ]] " Strip trailing whitespace -nnoremap :silent! %s/\v\s+$// -vnoremap :silent! '<,'>s/\v\s+$// +nnoremap silent! %s/\v\s+$// +vnoremap silent! '<,'>s/\v\s+$// " Convert double quotes to single. Convert only pairs to lower the false " positive rate. -nnoremap " :silent! %s/\v"([^"]*)"/'\1'/g -vnoremap " :silent! '<,'>s/\v"([^"]*)"/'\1'/g +nnoremap " silent! %s/\v"([^"]*)"/'\1'/g +vnoremap " silent! '<,'>s/\v"([^"]*)"/'\1'/g " Keep selection when changing the indentation in visual mode vnoremap > >gv @@ -339,5 +339,5 @@ function! ExpandVisualSelection(direction) endif endfunction -vmap j :call ExpandVisualSelection(1) -vmap k :call ExpandVisualSelection(-1) +vmap j call ExpandVisualSelection(1) +vmap k call ExpandVisualSelection(-1)