" 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 nnoremap k (v:count == 0 ? 'gk' : 'k') xnoremap k (v:count == 0 ? 'gk' : 'k') nnoremap j (v:count == 0 ? 'gj' : 'j') xnoremap j (v:count == 0 ? 'gj' : 'j') " Don't move cursor one character back on esc key press " inoremap :stopinsert " Don't get into insert mode after adding a line with o/O " nnoremap o o " nnoremap O O " Thanks https://github.com/drzel/vim-split-line nnoremap K :keep s/\s*\%#\s*/\r/e noh " 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 " Show who edited the current line from git history nnoremap :call gitblame#echo() " Open lazygit in a new tab with = nnoremap \| :tab ter ++close lazygit " 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