Using inserts, itβs very simple how to erase a word / section and paste over it, for example
cw delete to the end of the word (with space), then go to insert modece delete to the end of the word (no space), then switch to insert modec3w delete to the end of the next three words (with space), then go to insert modect. delete before the start of the period, then switch to insert modec$ delete to the end of the line, then switch to insert mode
How to do this using insert operations? Often I have a line like this
var name = "John Smith" var name = "Jane Smith"
And I change it to
var name = "John Lee" var name = "Jane Smith"
And yank ( yw ) is Lee, but now if I delete ( dw ) Smith from Jane Smith, I no longer have Lee in the registry to paste back. I know that I can use the named registers. Also, I'm sure I can use visual mode. However, I realized that since this is a fairly common task, you could use the motion operators ( e , w , t / t , f / f , $ , 0 ) with the insert command to indicate what you want to insert.
puk
source share