From f3ea7c8003c7a65de29c2f4e0e1bf0d592dd0ad8 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 28 Jan 2024 16:05:38 +0200 Subject: [.vimrc] Reworked entire vimrc --- .vim/mappings.vim | 143 ++++++++++++++++++++---------------------------------- 1 file changed, 53 insertions(+), 90 deletions(-) (limited to '.vim/mappings.vim') diff --git a/.vim/mappings.vim b/.vim/mappings.vim index 406c112..c620b69 100644 --- a/.vim/mappings.vim +++ b/.vim/mappings.vim @@ -1,123 +1,86 @@ -" Ctrl-C, Ctrl-V, ... {{{ - " Partly taken from: https://gist.github.com/jshih/3423345 - inoremap :w - inoremap + - inoremap ggVG - inoremap - inoremap u - - nnoremap :w - nnoremap ggVG - - xnoremap c+ - xnoremap ggVG - xnoremap "+y - xnoremap "+d -" }}} - -" Move lines with Alt-J, Alt-K {{{ - execute "set =\ej" - nnoremap :m+1 - execute "set =\ek" - nnoremap :m-2 - - xnoremap :m '>+1gv=gv - xnoremap :m '<-2gv=gv -" }}} - -" Omni completion (really needs a rework) {{{ - " Omni completion supports C, HTML, CSS, JavaScript, PHP, Python, Ruby, SQL, XML - set omnifunc=syntaxcomplete#Complete " Completion for all supported languages - - " Do omni completion from Ctrl+Space - inoremap - - " Thanks to: https://vim.fandom.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE - " set completeopt=longest,menuone - " [ The following are disabled, because they conflict with delimitMate's autobracket feature ] - " inoremap pumvisible() ? "\" : "\u\" - " inoremap pumvisible() ? '' : '=pumvisible() ? "\Down>" : ""' - - " "Disables" arrow navigation in completion menu - inoremap pumvisible() ? '' : '' - inoremap pumvisible() ? '' : '' - - " Pressing tab goes from top to bottom - let g:SuperTabContextDefaultCompletionType = "" -" }}} - -" When line is wrapped, going up or down will also go into the wrapped part -" move in wrapped lines when no count prefix +""" +""" Single key +""" + +nnoremap :mksession! .vim-session + noremap :ALERename +nnoremap :UndotreeToggle +nnoremap :call gitblame#echo() + +nnoremap :NERDTreeToggle + nnoremap k (v:count == 0 ? 'gk' : 'k') -xnoremap k (v:count == 0 ? 'gk' : 'k') nnoremap j (v:count == 0 ? 'gj' : 'j') +xnoremap k (v:count == 0 ? 'gk' : 'k') xnoremap j (v:count == 0 ? 'gj' : 'j') -" Don't move cursor one character back on esc key press -" inoremap :stopinsert +nnoremap \| :tab ter ++close lazygit + +""" +""" Shift + key +""" -" Don't get into insert mode after adding a line with o/O -" nnoremap o o -" nnoremap O O +let g:tabman_toggle = '' -" Thanks https://github.com/drzel/vim-split-line -nnoremap K :keep s/\s*\%#\s*/\r/e noh +""" +""" Control + key +""" + +inoremap :w +inoremap "+p +inoremap ggVG +inoremap +inoremap u + +nnoremap :w +nnoremap ggVG + +xnoremap "+p +xnoremap "+y +xnoremap "+d -" Better resizing when navigating splits nnoremap l= nnoremap h= nnoremap j= nnoremap k= + tnoremap l= tnoremap h= tnoremap j= tnoremap k= -" Ctrl-Backspace deletes the previous word in insert mode. inoremap cnoremap inoremap cnoremap -" Make session file -nnoremap :mksession! .vim-session +""" +""" Alt + key +""" -" Show who edited the current line from git history -nnoremap :call gitblame#echo() +" Move lines up/down with Alt-J/K +execute "set =\ej" +nnoremap :m+1 +execute "set =\ek" +nnoremap :m-2 -" Open lazygit in a new tab with = -nnoremap \| :tab ter ++close lazygit +xnoremap :m '>+1gv=gv +xnoremap :m '<-2gv=gv -" Tab navigtion execute "set =\eo" nnoremap gT inoremap gT tnoremap gT + execute "set =\ep" nnoremap gt inoremap gt tnoremap gt -" Arrows = bad -inoremap -inoremap -inoremap -inoremap -nnoremap -nnoremap -nnoremap -nnoremap - -" Cyrillic (Bulgarian yawerty layout) support -ca в w -ca ва wa -ca ь x -ca ьа xa - -" Make x and xa just save and quit without saving. This allows for closing all tabs and terminals. -ca x w q! -ca xa wa qa! - -" Open a terminal vim tab with tt and open a blank tab with te -ca tt tab ter -ca te tabe +""" +""" Two keys +""" + +nnoremap gd (ale_go_to_definition) +nnoremap gi (ale_go_to_implementation) +nnoremap ff (ale_hover) -- cgit v1.2.3