1

Given

a
b
c
d
e

I want to 5yy and then separately paste 5 lines in arbitrary locations in order of a b c d e instead of a separate yy p for each line.

Are there any plugins or Vim script that would service this type of workflow? Or is there a basic set of macros that would help me achieve this?

3

If you paste into order, we could imagine something that consumes one line in the unnamed register (or any other) each time it's used.

:nnoremap £ :call append('.', matchstr(getreg(v:register),"\\v.{-}\\ze\n"))<cr>:call setreg(v:register, substitute(getreg(v:register) , "\\v.{-}(\n\|$)", '', ''))<cr>

(Of course, a function (and using :put= instead of append()) would be better. This is just a quick and dirty solution. From a function we could have used matchlist() instead of matchstr() + substitute())

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.