Duplicate line/visual block

6 Points

Chris Penner Chris Penner

8 years ago

Remaps Y so that it duplicates the current line OR current selection to the line below. Overwrites default Y behaviour which is synonymous with yy.

Feel free to use nnoremap and vnoremap, or leave as nmap and vmap for increased compatability with some plugins.

"set Y to duplicate line or selection
nmap Y yyp
vmap Y y`>pgv " Duplicates then regains selection.