top | item 38030731

(no title)

igiveup | 2 years ago

It is not just typing in multiple places, but executing a vim command in multiple places. Which means, you can replace the insides of a parenthesis with something, then proceed to do the same action on a different-length parenthesis, without actually typing the whole command again. While not getting confused by other parentheses inside the first one, because the i( adverb handles that. Similar with quoted strings, words, sentences, paragraphs, etc.

By "repeat last command", I meant repeating a single command with ., which can do simple things like pasting a string, deleting something, toggling case, incrementing an integer, and probably more stuff I don't use. Then there are macros which can repeat multiple commands, and are actually not much harder to use than the dot.

Another thing I like about the repeating approach is that you don't have to find all the places beforehand. You can target some of them with a regex, then remember to do more of them with another regex, then the rest, one-by-one by hand.

I used to think that typing in multiple places at once was cool, but now I wouldn't go back. Not even if other editors are catching up. Are they, by the way? I remember Notepad++ could not do much more than insert the same string in multiple places at once, but I confess, I have never used VS Code, Sublime, Atom, or really anything that popped up while I was in the vim rabbit hole. Am I missing out?

discuss

order

No comments yet.