From c95bf42823e7311e5f69db8ae792dc30baae97c7 Mon Sep 17 00:00:00 2001 From: Pratik Tripathy Date: Mon, 13 Oct 2025 16:36:36 +0530 Subject: [PATCH] refactor(vim): Keymap updates for Vim - Auto-center cursor on more movements - fix: Quickfix traversals - Buffer traversal similar to Neovim - Paste without yanking - Remove all edit mode mappings copied from NvChad - Remove "copy all" mapping --- common/.vim/key_maps.vim | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/common/.vim/key_maps.vim b/common/.vim/key_maps.vim index 4d2ad90..6e62b42 100644 --- a/common/.vim/key_maps.vim +++ b/common/.vim/key_maps.vim @@ -36,6 +36,10 @@ nnoremap ]s ]szz nnoremap n nzzzv nnoremap N Nzzzv nnoremap G Gzz +nnoremap g* g*zz +nnoremap g# g#zz +nnoremap * *zzv +nnoremap # #zzv " Move visually selected lines around with J & K vnoremap J :m '>+1gv=gv @@ -66,10 +70,11 @@ map l " Navigate buffers nnoremap ]b :bnext nnoremap [b :bprevious +nnoremap bx :bd -" Navigate Quickfixs -nnoremap [q cprev -nnoremap ]q cnext +" Navigate Quickfix +nnoremap [q :cprevzz +nnoremap ]q :cnextzz " Resize window using arrow keys nnoremap :resize +2 @@ -91,13 +96,12 @@ vnoremap :wqa nnoremap :wa vnoremap :wa -" Move cursor in insert mode -inoremap ^i -inoremap -inoremap -inoremap -inoremap -inoremap +" Paste over currently selected text without yanking it +vnoremap p "_dp +vnoremap P "_dP + +" Copy everything between { & } including brackets +nnoremap YY va{Vy " Move Lines with Alt+j,k nnoremap :m .+1== @@ -113,9 +117,6 @@ imap , ,u imap . .u imap ; ;u -" Copy entire content of the current buffer -nnoremap :%y+ - " Copy to system clipboard nnoremap y "+y vnoremap y "+y