4 ms·
Does your example include the action of deleting bar with baz? Also, not having to move away from the home row makes me feel much faster. Having to use Alt/Co
by ta12121 14y ago
Does your example include the action of deleting bar with baz?
Also, not having to move away from the home row makes me feel much faster. Having to use Alt/Control/Arrows makes me cry. (I know you can't avoid Control in Vim, but in this example it is not required.)
ci"baz<esc> is 7 keystrokes, only one of which is a jump.
<ctl-F>bar<esc>baz is 8 strokes and two jumps. It also requires typing the entire string in quotes. If the example were
var foo = "The quick brown fox jumps over the lazy dog";
The vim example would not change but yours would.
I'm not trying to be an a-hole, use what you like, I'm just saying, that for me the attraction to vim is the strive toward the minimization of keystrokes, especially ones that require me to move my hands.
- recursive 14y agoNo, good point. You'd then have to type "baz". However, if I was actually faced with this problem, I'd use End, Ctrl + Left, Ctrl + D, baz, which is a total of 7 keystrokes. (if you don't release Ctrl) The vim example was 8 keystrokes. (" is shift + ') I have no doubt that you could manufacture an example that shows a benefit for vim, but I think that the advantages are overestimated by heavy vim users. Edit: Your longer string example is a good example of a task that's more efficient in vim.
- solutionyogi 14y agoI don't know why other Vim users focus on number of keystrokes. In his example, what is more important is that you are 'describing' what you want to do with text with commands. So when you have var foo1 = "bar"; var foo2 = "hello hi"; var foo3 = "when and why"; You can use the same command [cib"] to change the value assigned to foo1/foo2/foo3. You are describing your change semantically i.e. I want to change word inside the double quotes. In Sublime and other editors, it matters what the assignment is and you have to use different approach in each scenario. Frankly, as I type at 70wpm, I don't care about saving a few keystroke here and there.
- ta12121 14y agoI would personally dislike your example because of the use of extended keyboard keys that require repositioning the hand (End, Left).
- cgs1019 14y agoA commonly overlooked aspect to the vim way of describing what you're doing in verbs and nouns and prepositions is that the "." character in vim means "repeat my previous edit". So if you can find a way to "phrase" your edit as a single change (i.e., 6sasdf<esc> would delete six characters starting under the cursor and leaving me in insert mode, then insert the letters asdf and exit insert mode) instead of many (i.e., xxxxxxiasdf<esc>, deleting 6 characters separately, entering insert mode and entering the letters asdf) then you can go to another spot in the text and just hit . to repeat the edit. I've given a contrived example here, but this is enormously powerful. It's why there are several ways to enter insert mode: "i" to enter under the cursor, "a" for after the cursor, "I" for first non-whitespace character on the line, "A" for after the last character on the line, "o" for opening a new line below the cursor, "O" for above, "c"+motion for deleting through the motion and leaving in insert mode, count+"s" for removing count characters starting from cursor and leaving in insert mode. There are more....I'll stop :)
- Scaevolus 14y agoSublime Text supports multiple cursors, which I find to be a more natural way to do things where you might use those tiny repetitions-- you select all the regions you want to edit first (usually by repeatedly adding the next match to the selection), then any typing or movements you do occur in parallel.
- dllthomas 14y agoci{
- SilasX 14y agoSome Vimmers (like me) remap a key combination (pref one you rarely would want to add to the text) to Esc so you don't have to leave the home row. I use ;j or lkj. (and If you actually want to type those in insert mode, just do it a bit more slowly or with ;ji escape-inserts between the characters. Generally, it takes a long string of keystrokes before moving off the home row is faster.