I would like to replace a rectangular area with a yanked single string (as opposed to another rect area).
For example, yank the string “foobar”, select the numeric characters of the following table and paste the string over the rectangular region.
poum 123 pam
poum 456 pam
poum 789 pam
Which would yield this output:
poum foobar pam
poum foobar pam
poum foobar pam
BBedit has this capability and I find it quite handy. The only way I found to do this with Vi is to yank the string into a given register (say register “a”), select the region, delete it, reselect it using gv, and finally paste the string using I ctrl –r a esc .
I am looking for a simpler way to do this. E.g. select the region, paste the string. It should be as simple as pasting a rect area to another rect area (an operation described here: Vim: how to select a rect area and do copy/paste).
Yank the string you want to paste. Select the area you want to replace (with Ctrl+v). Press c to cut the area out and go into insert mode, then Ctrl+r then 0 (zero) to paste the contents of register 0 (since the text you cut went into
") and finally Esc to leave insert mode. Or yank into a particular register explicitly ("ay) and paste from that one (Ctrl+r a).