diff options
Diffstat (limited to '.vim/startup/mappings.vim')
| -rw-r--r-- | .vim/startup/mappings.vim | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/.vim/startup/mappings.vim b/.vim/startup/mappings.vim new file mode 100644 index 0000000..4aec7f1 --- /dev/null +++ b/.vim/startup/mappings.vim @@ -0,0 +1,71 @@ +" Don't get into insert mode after adding a line with o/O +nnoremap o o<Esc> +nnoremap O O<Esc> + +" Ctrl-Backspace deletes the previous word in insert mode. +inoremap <C-h> <C-w> +inoremap <C-BS> <C-w> + +" Ctrl+s; Ctrl+c, Ctrl+v, Ctrl+x; Ctrl+z, Ctrl+r; Ctrl+a bindings that work on GUI applications +" Partly taken from: https://gist.github.com/jshih/3423345 +imap <C-s> <Esc>:w<CR>a +nmap <C-S> <Esc>:w<CR> +"imap <C-S-z> <C-r> An impossible dream +vmap <C-c> "+yi<Esc> +vmap <C-v> c<ESC>"+p<Esc> +imap <C-v> <ESC>"+pa +vmap <C-x> "+c<Esc> +imap <C-z> <ESC>ui +imap <C-r> <ESC><C-r>i +map <C-a> ggVG + +" Show all buffers and be able to just type in the number of the buffer +map <C-f> :set nomore<Bar>:ls<Bar>:set more<CR>:b<Space> + +" Move a line up and down with Alt+k and Alt-j +execute "set <M-j>=\ej" +nnoremap <M-j> <ESC>:m+1<CR> +execute "set <M-k>=\ek" +nnoremap <M-k> <ESC>:m-2<CR> + +" Make session file +nnoremap <F1> <ESC>:mksession! .vim-session<CR> +" Show who edited the current line from git history +nnoremap <F8> :<C-u>call gitblame#echo()<CR> +" Open lazygit in a new tab with = +nnoremap = :tab ter ++close lazygit<CR> + +" 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 <bar> q! +ca xa wa <bar> qa! + +" Open a terminal vim tab with tt and open a blank tab with te +ca tt tab ter +ca te tabe + +" Omni completion {{{ + " 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 <C-@> <C-X><C-O> + + " 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 <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" + " inoremap <expr> <C-n> pumvisible() ? '<C-n>' : '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>' + + " "Disables" arrow navigation in completion menu + inoremap <expr> <up> pumvisible() ? '<c-y><up>' : '<up>' + inoremap <expr> <down> pumvisible() ? '<c-y><down>' : '<down>' + + " Pressing tab goes from top to bottom + let g:SuperTabContextDefaultCompletionType = "<c-n>" +" }}} |
