34 lines
1.0 KiB
VimL
34 lines
1.0 KiB
VimL
"Visual {{{
|
|
" Fast beginning and end of document
|
|
vnoremap ¿ G
|
|
vnoremap <Bar> gg
|
|
|
|
" Move a line of text using Shift+[jk]
|
|
vnoremap <S-j> :m'>+<cr>`<my`>mzgv`yo`z
|
|
vnoremap <S-k> :m'<-2<cr>`>my`<mzgv`yo`z
|
|
|
|
" 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'
|
|
|
|
" 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
|
|
|
|
" global replace
|
|
vnoremap <Leader>sw "hy
|
|
\ :let b:sub = input('global replacement: ') <Bar>
|
|
\ if b:sub !=? '' <Bar>
|
|
\ let b:rep = substitute(getreg('h'), '/', '\\/', 'g') <Bar>
|
|
\ execute '%s/'.b:rep."/".b:sub.'/g' <Bar>
|
|
\ unlet b:sub b:rep <Bar>
|
|
\ endif <CR>
|