Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you're into that sort of thing, you can do Ctrl + F, bar<esc> in Sublime too. Most of the comparisons in this discussion between vim and non vim demonstrate high proficiency in vim, but not as much elsewhere. Of course you are more proficient in the tool you know best.


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.


No, 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.


A 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 :)


Sublime 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.


I 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.


I would personally dislike your example because of the use of extended keyboard keys that require repositioning the hand (End, Left).


ci{


Some 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.


As a heavy user of Sublime, Coda 2 and someone that is still getting to grips with vim, I'd say the real advantage of vim is you can do all of that over ssh with minimal keystrokes over a crappy connection.


Actually, this is almost the scenario for which Vim's father was designed.


You can use any editor over ssh these days. Just mount it with sshfs.


Sure, but you can't do low-latency screen-sharing inside a tmux session over sshfs.


Coda's "open quickly" is too slow to use over SSHFS (although is OK on a local network over AFP). Sublime's not too bad but it can take a while to build its file list.


Exactly, and does it really matter? I mean, how many people in usesthis.com actually use Vim? And they are all brilliant people.


https://www.google.com/#hl=en&output=search&sclient=...

Gives back a list of interesting people.

Not that I think it matters if you use Vim or anything particular for that matter.


Brilliant people don't need to be brilliant in everything. You can use lesser tools and still accomplish a lot.


Or maybe they're not lesser tools.


Yes, but the set of brilliant people is larger than the set of brilliant people using the best tool in each area. We don't live in a perfect world, and brilliant people make trade-offs. Unless you know what kind of trade-offs they made, you can't generalize their choices. For instance, when Peter Norvig switched from Lisp to Python for his classes, many people argued that Python was an "acceptable Lisp". When asked about his decision, Norvig answered that Python was a better choice for his teaching goals, and nothing else.

Also, let's not confuse techniques with tools. It is unfortunate that, other than modal editing which is too generic, we don't have a name for Vi-style editing which does not involve Vi, so people confuse Vi-style editing (e.g. the technique), with Vi (e.g. the tool). The tool may have its own shortcomings which render it unsuitable.


ctrl+f,bar,esc,ctrl+shift+right,foo

i think it's easier to grab the mouse, dlb click bar, foo

with vim, it's still easier than grabbing the mouse. that's the litmus test of text editor interface effectiveness. the mouse is awesome, hard to beat. so if your editor beats it, game on!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: