3 ms·
please correct me if I'm wrong, but wouldn't :'<,'>s/_b/B/ work in this case?
by deviantfero 8y ago
please correct me if I'm wrong, but wouldn't
:'<,'>s/_b/B/
work in this case?
- fredsted 8y agoIt might work if you want to fiddle with a regex for several minutes, so I'd prefer to just select a bunch of lines do the change directly
- jcelerier 8y agoit's more keystrokes (and more complicated ones) than just doing cursor editing, and you have to think of every replacements in advance while with the multi cursor if you have five others replacements to make in the same line you can just make them easily one after the other
- deleted 8y ago[deleted]
- akashakya 8y agoWith multiple cursors you are seeing the changes as you are editing. and you have all of the normal editing shortcuts at your disposal. Example, if you made a mistake while typing just hit undo.
- bhaak 8y agoI would rather add the c option in cases where I'm not 100% sure what I'm doing. So in this case :'<,'>s/_b/B/c That let's you step through every change and if something's wrong you can press ESC and u to undo only the last change. It depends on the actual problem of course, but multicursor edits also get unwieldy if you're editing more than 2 or 3 lines. What about if the lines are beyond the visible screen?
- akashakya 8y agoYes, no silver bullet. But most of my use case I find a generic pattern so I don't check the individual edits. Anything more complex I'll switch to macros. Btw, I meant undo like global undo which will let you undo the last keypress for all of the cursors. In your case, you meant undo for a particular instance of change I guess. Also, let's say there is different character after _ foo_bar -> fooBar baz_car -> bazCar some_thing -> someThing Maybe you can do this with regex. but for a new user, he has to look it up. With multiple-cursors, you don't even have to think about it. However, you can use a macro.