From 6bb055d42f282ed5e986d9ca066d41260361e311 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Sun, 28 Nov 2021 19:40:52 +0100 Subject: [PATCH] Add and reorder nvim mappings --- home/.config/nvim/rc/mappings.vim | 70 ++++++++++++++++++------------- 1 file changed, 41 insertions(+), 29 deletions(-) diff --git a/home/.config/nvim/rc/mappings.vim b/home/.config/nvim/rc/mappings.vim index 4b3bf35..65e1935 100644 --- a/home/.config/nvim/rc/mappings.vim +++ b/home/.config/nvim/rc/mappings.vim @@ -4,13 +4,46 @@ nnoremap nnoremap nnoremap -" Stop search highlight with Esc in normal mode (until next search) -nnoremap :noh +" Tab navigation +nnoremap gt +nnoremap gT +nnoremap :tabnew +nnoremap :tabmove + +nnoremap :tabmove - +nnoremap :tabp +nnoremap :tabn + +" Splits navigation to just ALT + hjkl +nnoremap h +nnoremap j +nnoremap k +nnoremap l + +" Make adjusting split sizes a bit more friendly +noremap :vertical resize +3 +noremap :vertical resize -3 +noremap :resize +3 +noremap :resize -3 " System clipboard interactions map "+y vnoremap "+p +" Use more common Undo/Redo shortcuts +nnoremap :undo +nnoremap :redo + +" Use more common save shortcut +nnoremap :w + +" Terminal +nnoremap :vnew term://zshi +nnoremap :split term://zshi +nnoremap :tabnew term://zshi + +" Alias replace all +nnoremap :%s//gI + " Start spell-check map s :setlocal spell! spelllang=en_us @@ -22,37 +55,16 @@ vnoremap zf noremap K 10k noremap J 10j +" Save file as sudo when no write permissions +cmap w!! w !sudo tee > /dev/null % + +" Stop search highlight with Esc in normal mode (until next search) +nnoremap :noh + " Enable/Disable auto comment map c :setlocal formatoptions-=cro map C :setlocal formatoptions=cro -" Tab navigation -nnoremap gt -nnoremap gT -nnoremap :tabnew -nnoremap :tabmove + -nnoremap :tabmove - -nnoremap :tabp -nnoremap :tabn - -" Remap splits navigation to just CTRL + hjkl -nnoremap h -nnoremap j -nnoremap k -nnoremap l - -" Make adjusting split sizes a bit more friendly -noremap :vertical resize +3 -noremap :vertical resize -3 -noremap :resize +3 -noremap :resize -3 - -" Alias replace all -nnoremap :%s//gI - -" Save file as sudo when no write permissions -cmap w!! w !sudo tee > /dev/null % - " Don't leave visual mode after indenting vmap < >gv