I want a mapping that does it.
Apparently, it is not that simple.
Because first, it might decide to keep it commented when I press o.
And it behaves differently if it was copied by yy, insists adding additional <CR>
.
My best effort so far is this:
function! MPf()
let @+ =substitute(@+,"\<NL>$","",'')
exec "norm x\"+]P"
endfunction
nnoremap mp o <esc>:s/[^ \t]//ge<CR>:call MPf()<CR>
I add a space so that won't cancel indentation. I delete every comment like char in a new line.
But some combination of doing y/yy and when on indented line/unindent line originally still cause troubles. And somehow I don't get rid of the additional \0
.
]p
does this. – Matt Nov 2 '19 at 14:03yy
. Although you are right that I could identify this situation and apply]p
only if it happens. – eyal karni Nov 2 '19 at 14:04