Last active
August 29, 2015 14:00
-
-
Save AndrewRadev/11408444 to your computer and use it in GitHub Desktop.
Example for the "_dd problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nnoremap gp :call <SID>CommentedPaste()<cr> | |
function! s:CommentedPaste() | |
let text = getreg(v:register) | |
let commented_lines = [] | |
for line in split(text, "\n", 1) | |
call add(commented_lines, substitute(line, '\s*\zs\S', '# \0', '')) | |
endfor | |
call setreg(v:register, join(commented_lines, "\n")) | |
exe 'normal! "'.v:register.'p' | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment