views:

2133

answers:

9

This may sound a bit provocative but it actually is a real question. Feel free to edit if you don't like the tone.

Now, as much as I understand vi from my short experience with it like 10 years ago, it's a primitive text editor with one editable line at the bottom of the screen created before the scrollbars were invented, with some crazy shortcuts to overcome this limitation.

Can somebody explain me how one can be more productive with it than with, say normal VS.NET editor? Moreover, why would anybody want to use viEmu which supposedly turns your VS.NET into an ancient vi?

I'm willing to give it a try but I need some motivation to overcome the learning curve.

EDIT: Thanks to everybody who replied, I'm checking it out. See my blogpost at http://zvolkov.com/blog/post/2009/04/15/Learning-VI.aspx for account of my experience.

+4  A: 

I think they have a long and acceptable answer for your question on the viEmu hompage:

One other even more powerful example: let's take the 'ce' command, which is composed of 'c' and 'e'. The 'c'hange command deletes the range specified by the next motion command, and also enters insert mode. It's the same as 'd', but with the distinction that it enters insert mode, instead of staying in normal mode. The boon is that the text you type in the next (short) input session is also part of the command. So if you do 'ceHello>', what you do is replace from the cursor to the end of the word by 'Hello', and the '.' command afterwards will work exactly like that: replace up to the end of the word with 'Hello'.

From: http://www.viemu.com/a-why-vi-vim.html

I have viEmu installed ~half year ago. But I have to say (maybe without strong linux experiences) I've never used it. Too alien, too far, too complex.

So IMHO viEmu it's a great technical&historical challenge but no more for the 95% of the developers.

boj
Upon reading the linked page, I'm accepting this answer as "the right one". I liked Chad Birch's answer better but this was the first answer that gave the (now obvious) link.
zvolkov
On the second thought, for the sake of future generations of readers I have to revoke my voice from this answer and give it to Chad Birch. Being the first to send a link is cool but being able to provide a useful answer is more important.
zvolkov
+53  A: 

It honestly sounds like you have never seen someone use Vi who is truly proficient in it. When you normally use Visual Studio you frequently will move your hand over to your mouse, click through options, dialogs, classes, etc.

With ViEmu your hand never leaves the keyboard. You are compiling, switching files, highlighting groups of text, fixing indentation, performing complex motions on your code and running regular expression searches in seconds. For people who are fast typists it allows you to achieve a speed for tasks you would not be able to otherwise.

Many people will counter this by saying things like, "Most of my development time is spent thinking. The extra speed I gain from using tools like these is negligible.".

That is a non-argument in my opinion. It is true, for most large programming tasks you spend far more time planning and thinking then you do actually slinging code. But that doesn't mean that being able to express yourself through your IDE 2x faster doesn't have an impact on your productivity as a programmer.

Simucal
Wish I could double up vote your answer. I find ViEmu to be an invaluable tool
JaredPar
But _how_ does it make it possible? What is the secret sauce that other editors lack?
zvolkov
non-Insert mode. Most editors are just Insert mode, but Vi has many other modes, which interpret the keys differently. This lets you move around and modify things much faster (for example: instead of just arrow keys to move you get a TON of navigation commands).
Herms
@zvolkov, like Herms said, the non-insert mode. You have a ton of complex "motions" which you can combine with each other and certain commands to do some pretty nifty stuff.
Simucal
@zvolkov, your question now is boiling down to what is it about Vi in general that makes it more powerful than a normal text editor. I suggest you get some exposure to Vi and take its built in tutorial. Once you have been exposed to some of its more powerful commands and motions you won't go back
Simucal
Year to the question poster. This guy/gal has it. Watch a vim guru in real life exercising his craft, otherwise it will take a long time to truly see the point.
michael
Once it truly sits in your head it becomes like typing you just think what you want and your hands do the work for you.
Ben
I have been searching for Youtube videos etc looking for demonstrations from people who are really proficient in Vi/Vim but all I get are beginner's tutorials. It's really hard because nobody I know personally uses Vi. Do you know where I can find demonstrations by people really proficient in it?
thomasrutter
+6  A: 

You are wrong about "one editable line at the bottom of the screen." All the text in the window is editable. And it does scroll (all versions) and in the case of gvim, has scrollbars.

Maybe you inadvertently put it in "ex mode". This is easily done and can be confusing.

finnw
+1  A: 

I have not experience with VS.Net but I guess it has the same features that any other IDE has.

I have found that learning the all the key commands of the editor in my IDE was a sufficient replacement for Vi. Things like renaming, indenting, formatting, moving lines and that kind of stuff.

So I guess the major win would be for someone who already know Vi to be productive without having to learn VS.Net.

But then again, Vi has some truly esoteric but powerful features that probably can't be matched by you standard IDE editor.

John Nilsson
+38  A: 

The viEmu page itself has a pretty good article that might help to answer your question: Why, oh WHY, do those #?@! nutheads use vi?

I've spent the last couple months trying to teach myself to use vim "properly" and now I can hardly stand using other editors because they seem underpowered and clunky. For a random example, imagine you have a line of code that looks like this:

$welcomeMessage = "Welcome to SiteName!"; // shows at the top of homepage

In a normal editor, how would you change the string? You'd probably have to reach over and grab your mouse and carefully select it, or you'd move your cursor inside the first quotation mark, and hold down Shift and the right-arrow until you got to the closing quotation mark.

In vim, with my cursor anywhere in-between the quotes, I type ci" and it erases everything inside the quotation marks and puts me into insert-mode so I can type the new value I want. My hands didn't even have to move from my normal typing position.

There are so many things like this, I think you really have to spend a while using the editor to understand how powerful it is. It's very slow and hard to use at first, that's why a lot of people try it for a short time and think "this is dumb, everything is way harder", but after a while you start thinking in terms of the motions, it all starts to become automatic and it's much, much faster than using a "normal" editor. As I said, I can't go back now.

Chad Birch
The ci" example didn't work in 6.4; then I tried it in 7.2 and it did. FYI
gbarry
These are called text-objects and are truly awesome quite recent addition see :help text-objects. If you want to select/change/remove text between delimiters then chances are theres a text-object that can handle it
Ben
+1 for text-objects. Didn't know about this!
Wim Coenen
A: 

I actually use VS only for debugging these days. Coding with vim (real vim, not viemu) is just a better experience.

Now, I am not going to claim that using one over another makes any difference in productivity - after all I spend most of my time trying to figure out how to solve a problem - entering the code is the easy part.

Nemanja Trifunovic
I tend to prefer an IDE with a vim plugin to just Vim itself. Regular Vim loses a lot of the IDE's extra features (language-aware autocomplete, etc). Netbeans + jVi plugin is so much better than just Netbeans or just Vim. Though regular Vim works great for languages w/o any good IDE.
Herms
+1  A: 

I think you really should give Vim a try.
If you quickly tried Vi ten years ago, I may understand you didn't appreciate it. It's not really user-friendly at first sight. Actually its real power is revealed when you start feeling comfortable with the movements and start making it your own with customisation. Once Vim is familiar to you you may understand why it deserves to be learnt.

Taurus Olson
+2  A: 

Another answer got me thinking that watching some skilled editing using vim would be pretty revealing so I dug up this video showing basic and more advance motions while coding. This person could get even a bit efficient using some marks, etc but it gives an idea.

http://www.youtube.com/watch?v=FcpQ7koECgk&feature=related

+2  A: 

If you need inspiration or want to see someone who really knows what they are doing with Vim, check out Gary Bernhardt's String Calculator Kata In Python, look at him go! http://vimeo.com/8569257

Roberto Sebestyen