1
0
Fork 0
numbers/nvim/plugin/mappings/visual.vim

27 lines
855 B
VimL

" j = gj :: k = gk while preserving numbered jumps ie. 12j or 30k
vnoremap <buffer><silent><expr>j v:count ? 'j' : 'gj'
vnoremap <buffer><silent><expr>k v:count ? 'k' : 'gk'
"Shift lines up and down
vnoremap J :m '>+1<cr>gv=gv
vnoremap K :m '<-2<cr>gv=gv
" Fix indentation without leaving visual mode
vnoremap > >gv
vnoremap < <gv
" Keep cursor at the bottom of the visual selection after you yank it.
vmap y ygv<Esc>
" Delete current visual selection and dump in black hole buffer before pasting
" Used when you want to paste over something without it getting copied to
" Vim's default buffer
vnoremap p "_dP
" Wrap visual selection
vnoremap <leader>' <esc>`>a'<esc>`<i'<esc>
vnoremap <leader>" <esc>`>a"<esc>`<i"<esc>
vnoremap <leader>( <esc>`>a)<esc>`<i(<esc>
vnoremap <leader>[ <esc>`>a]<esc>`<i[<esc>
vnoremap <leader>{ <esc>`>a}<esc>`<i{<esc>