Fork me on GitHub
#vim
<
2022-05-06
>
James Amberger23:05:57

how do you guys usually paste a form into another form?

snoe00:05:07

p but maybe you're looking for something like wrap in parens? vimsexp (and vimsexp for humans) give a lot of paren manipulation objects and movements.

sheluchin11:05:01

Sometimes I go to end of the form, insert a new line, adjust the indent to my preferred level, exit insert mode, and the paste with [p. Now that I type it out, sounds so convoluted lol but I haven't got my indent settings quite how I like them otherwise, and I have the muscle memory for this one.

James Amberger12:05:33

@UPWHQK562 that’s just what I mean. I have tpope’s vim-sexp bindings installed.

(yank this form)

(paste
  end
  of
  this)
So I can yaf the first form, and then… I could nav to the second one, type >I to open insert mode at the end of the second form, enter a newline, exit insert mode, then paste with =p. Perhaps I’m spoiled by all the neat stuff you can do with structural editing with vim-sexp etc but this seems rather unwieldy.

James Amberger12:05:41

I could also move to the last line of target form, paste linewise, slurp, and reformat

James Amberger12:05:46

that’s not too bad I guess.

James Amberger12:05:31

Also not great that if pasting into a one line form, yaf doesn’t paste with spaces around it (which would be analogous to yaw in vanilla vim)