4 ms·
> Because of the verb followed by object grammar, vi changes are made in the dark, we dont see their effect until the whole editing sentence is finished. dtf wi
by dghf 8y ago
> Because of the verb followed by object grammar, vi changes are made in the dark, we dont see their effect until the whole editing sentence is finished. dtf will delete to next f, if you then realize that was one f before the one you targeted, you need to undo, go back to your initial position, and try again with d2tf.
Or just do . (full stop/period), which will repeat the last command, and in this case delete to the f you want.
- Lio 8y agoAlso, if you want to see what you’re working with before you make a change in vim you can always use visual mode. So the example given, dtf would become vtfd. That’s one extra key stroke but realistically if you can touch type you won’t notice. You can expand that selection with ; for the next t. Personally I’d use dtf and then just use undo if its not what I want. I’d also use dot repeat command, gcf or a visual column to act on multiple selections.
- FreeFull 8y agoUnfortunately, visual mode still only gives you a single selection.
- Lio 8y agoTrue. An alternative if you want to see all your selections highlighted would be to turn search highlighting using set incseach and hlsearch. Use / to first select what you want to change. Then use cgn to make a change and . to repeat it. n will skip a change. This still might not be exactly what you want and that’s fine. It’s always good to try new ideas and new software but for me vim gives me plenty of options already.
- exDM69 8y agoRepeat will only fix this particular case. If you did "dtf" and wanted "dff", repetition won't help. Kakoune is kinda like vim in visual mode (or block visual) with multiple cursors.
- dghf 8y ago> Repeat will only fix this particular case. If you did "dtf" and wanted "dff", repetition won't help. My point wasn't that repetition is a panacea, but that the example in the article isn't a good one.