Skip to content

Instantly share code, notes, and snippets.

@haya14busa
Created March 1, 2014 21:40
Show Gist options
  • Select an option

  • Save haya14busa/9297839 to your computer and use it in GitHub Desktop.

Select an option

Save haya14busa/9297839 to your computer and use it in GitHub Desktop.
" Yank with keeping cursor position in visual mode {{{
function! s:wrap_y(command)
exec "normal! gv" . a:command
exec "normal! gv\<ESC>"
endfunction
xnoremap <silent> y <ESC>:call <SID>wrap_y('y')<CR>
xnoremap <silent> Y <ESC>:call <SID>wrap_y('Y')<CR>
"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment