From f950284763ac3159a509eb29a865c28948d890e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Thu, 2 Mar 2023 11:49:38 +0100 Subject: [PATCH] Added the vim def MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcin Woźniak --- .vimrc-def | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/.vimrc-def b/.vimrc-def index 4cd5e28..a957ede 100644 --- a/.vimrc-def +++ b/.vimrc-def @@ -83,6 +83,104 @@ nnoremap :tabnext cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! + +"""""""""""""""""""""""""""""""" +" Keyboard shortcuts +"""""""""""""""""""""""""""""""" +let mapleader = "\" +nmap 2 :w! + +" Better tab +vnoremap > +vnoremap < + +" Better word +nmap yw vey + +" Select all text +nmap ggG + +" Resize window +nnoremap :vertical resize +5 +nnoremap :vertical resize -5 +nnoremap :res -5 +nnoremap :res +5 + +" Split window +nnoremap _ :vsp +nnoremap - :split + +" Reload file +nnoremap :edit +nnoremap :edit! + +inoremap pumvisible() ? "\" : "\" + +" Moving line up or down using alt +nnoremap :m-2 +nnoremap :m+ +inoremap :m-2 +inoremap :m+ +vnoremap :m '>+1gv=gv +vnoremap :m '<-2gv=gv + +nnoremap Ż :m-2 +nnoremap ∆ :m+ +vnoremap ∆ :m '>+1gv=gv +vnoremap Ż :m '<-2gv=gv + +nnoremap :m-2 +nnoremap :m+ +inoremap :m-2 +inoremap :m+ +vnoremap :m '>+1gv=gv +vnoremap :m '<-2gv=gv + +" Better replace +nnoremap s :%s//g +vnoremap s :s//g + +" Better adding into begging and ending line +vnoremap F $A +vnoremap f 0I + +" Better management of tabs +nnoremap :tabnew + +nnoremap :tabprevious +nnoremap :tabnext +inoremap :tabpreviousi +inoremap :tabnexti + +nnoremap k :tabprevious +nnoremap j :tabnext + +inoremap :tabnew + +" Better moving +nnoremap J } +nnoremap K { +vnoremap J } +vnoremap K { + +" Copy into system +noremap y "*y +noremap p "*p + +" Code +map Vgaip= + +" Others +nnoremap :Goyo +cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! +map :setlocal spell! spelllang=en_gb +map :setlocal spell! spelllang=pl + +" Human Errors +:command! W w +:command! Q q +:command! Wq wq + " Automatically deletes all trailing whitespace and newlines at end of file on save. autocmd BufWritePre * %s/\s\+$//e autocmd BufWritepre * %s/\n\+\%$//e