News for hackers. Stuff that matters.
Re:Vim Creep by xutopia on Thursday July 12, 2012 @03:26PM (#4236238)
You really have to sit down and see a vim user work to start to understand.

In vim you don't just move around with arrows, then delete and then replace the text you want. What happens is you can use noun-verb associations to do things.

For example on a line like this:

    var foo = "bar";
I could be at the beginning of the line and type the following keys to change the inside of the quotation marks:

    ci"baz<esc>
In sublime I would do the following:

    <cmd>→←←⌫⌫⌫baz
The difference between the two was an epiphany for me. In vim I could actually use verbs and nouns to determine how I will edit the text in front of me. I now have a language that I can use to edit text rather than editing the text using the most manual of tools and the verbs and nouns combination are only limited by my imagination and the plugins I install.
Re:Vim Creep by recursive on Thursday July 12, 2012 @03:39PM (#4236321)
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.
Re:Vim Creep by ta12121 on Thursday July 12, 2012 @03:50PM (#4236401)
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.

Re:Vim Creep by recursive on Thursday July 12, 2012 @03:59PM (#4236440)
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.

Re:Vim Creep by cgs1019 on Thursday July 12, 2012 @04:32PM (#4236624)
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 :)
Re:Vim Creep by Scaevolus on Friday July 13, 2012 @02:57AM (#4238568)
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.
Re:Vim Creep by solutionyogi on Thursday July 12, 2012 @04:12PM (#4236504)
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.

Re:Vim Creep by ta12121 on Thursday July 12, 2012 @04:30PM (#4236606)
I would personally dislike your example because of the use of extended keyboard keys that require repositioning the hand (End, Left).
Re:Vim Creep by dllthomas on Thursday July 12, 2012 @04:55PM (#4236757)
ci{
Re:Vim Creep by SilasX on Friday July 13, 2012 @04:20AM (#4238800)
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.
Re:Vim Creep by rahoulb on Thursday July 12, 2012 @05:23PM (#4236913)
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.
Re:Vim Creep by lelele on Thursday July 12, 2012 @06:46PM (#4237249)
Actually, this is almost the scenario for which Vim's father was designed.
Re:Vim Creep by mixmastamyk on Thursday July 12, 2012 @10:32PM (#4237939)
You can use any editor over ssh these days. Just mount it with sshfs.
Re:Vim Creep by technomancy on Friday July 13, 2012 @12:16PM (#4240409)
Sure, but you can't do low-latency screen-sharing inside a tmux session over sshfs.
Re:Vim Creep by rahoulb on Friday July 13, 2012 @02:11AM (#4238459)
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.
Re:Vim Creep by why-el on Thursday July 12, 2012 @03:45PM (#4236353)
Exactly, and does it really matter? I mean, how many people in usesthis.com actually use Vim? And they are all brilliant people.
Re:Vim Creep by jeffesp on Thursday July 12, 2012 @04:49PM (#4236721)
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.

Re:Vim Creep by lelele on Thursday July 12, 2012 @06:44PM (#4237241)
Brilliant people don't need to be brilliant in everything. You can use lesser tools and still accomplish a lot.
Re:Vim Creep by hollerith on Thursday July 12, 2012 @08:46PM (#4237648)
Or maybe they're not lesser tools.
Re:Vim Creep by lelele on Friday July 13, 2012 @10:02AM (#4239821)
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.

Re:Vim Creep by gcb on Thursday July 12, 2012 @04:17PM (#4236534)
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!

Re:Vim Creep by anextio on Thursday July 12, 2012 @03:33PM (#4236284)
Actually you can do it with:

<cmd>-<right>, <option-left>, <option-shift-right>, baz

And considering you didn't have to press <mode>: beforehand, it can be just as fast.

I'm a vim user, but using it for something like Objective-C in place of the wonderful autocomplete in Xcode would be a totally dumb thing to do. It's simply not smart enough to improve my productivity, even with the slight speed increases with text-manipulation.

Re:Vim Creep by weaksauce on Thursday July 12, 2012 @04:28PM (#4236596)
Try out xvim if you want to use Xcode + vim. It's still alpha but I use it for all my Xcode editing. Patches welcome.

edit: link - https://github.com/JugglerShu/XVim

Re:Vim Creep by andrew_k on Thursday July 12, 2012 @03:50PM (#4236397)
That's why I switched to AppCode for Objective-C code editing. It has pretty good Vim bindings plugin, and you still have an autocomplete.
Re:Vim Creep by tripzilch on Thursday July 12, 2012 @08:04PM (#4237505)
It probably helps to explain that ci"baz<ESC> means: change (c) what's inside (i) the apostrophes (") to baz (baz), end (<ESC>)
Re:Vim Creep by kicweed on Friday July 13, 2012 @02:30AM (#4238504)
First time users of vim would use the arrow keys too. Only after you gain some experience do you start thinking with motions.

The same holds true for Sublime Text. Instead of using the arrow keys, you could do any of the following:

  Ctrl+H : Replace
  bar : Find what
  baz : Replace with
  Ctrl+Shift+H : Replace first match
  <esc> : Exit replace mode
or

  Ctrl + I : Incremental Find (finds and selects finding)
  bar : Find & select text
  baz : Overwrite selection
or

  Ctrl+<Right>+<Right>+<Right>+<Right> : Reach the word bar
  Ctrl+d : Select word under cursor
  baz : Overwrite selection
or

  Ctrl+P : GoTo Anything
  # : Goto word
  bar : Goto word 'bar' & select it
  baz : Overwrite selection
I agree that vim's vocabulary is very expressive and very powerfull. I switched to Sublime Text because tweaking vim to meet my needs was just too much effort, even for simple things. Couple this with even more effort to make it play nice with Greek (my native language), and the switch came naturally.
Re:Vim Creep by wonderzombie on Thursday July 12, 2012 @06:34PM (#4237206)
Is there a reason why you wouldn't use Vintage with ST2? ci works better in Vim, for sure. But ci is still incredibly useful with Vintage:

    f"ci"baz
Re:Vim Creep by andyl on Thursday July 12, 2012 @04:24PM (#4236576)
Wow - I never realized ci"baz<esc> would work with the cursor starting in column 0 - thanks for this tip !!