Some people say they hate the Vim's modes. Puzzling, because I consider the modes as the killer feature of Vim, something that makes it superior to Emacs.
Why modes rock
I spend most of the time in the normal mode. In this mode, undo is just u, delete line dd and move one word forward w. In Emacs these commands would all include ctrl, shift, alt or whatever. Inserting text is not what I spend most of the time in an editor on. Most of the time I need to quickly navigate around and make small modification to an already existing text. It is false economy to have the keys on the keyboard be bound to less often used functionality all the time.
When I reach the exact place where I need to enter some text, I press i to enter insert mode, type it, and immediately get back to normal mode (I get to normal mode by pressing ctrl-[ rather than ESC).
Why modes frustrate newbies
While pairing with people new to Vim I noticed that they leave it in whatever mode. So if they were inserting, they live it in insert mode. When they come back to Vim window (after inspecting results of a test run for example), they think they are typing normal-mode commands, but are actually in the insert mode typing text. Or the opposite situation: start typing and instead of inserting text they are rapidly killing one chunk of the file after another.
Experienced Vimers follow a convention. After doing something briefly in other mode, immediately go back to the normal mode. I never live Vim in the insert mode or any other mode than normal; when I get back to the Vim window I can always assume Vim is in the normal mode.
6 comments:
And there you have a text editor whose 'normal mode' is not for editing... ;-)
Fair enough. Different strokes for different folks, I guess.
Perhaps you could give us newbies a crash course on Vim when we sit at your computer :) Or maybe hang a cheat sheet somewhere!
I still plan to use emacs, at least for a few weeks to see if I like it. But don't worry, I'm already writing a cheat sheet for emacs newbs :P
A pretty nice cheat sheet, plus a cheat sheet based tut!
http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html
Normal mode in vim is an unnecessary abstraction layer for a text editor. For one, two, a few edits in a file I can accept switching back and forth between modes. If it's much more than that, I always ended up staying in insert mode anyway, and then, what's the point..
Oh, and navigating in emacs is not that hard. The arrow keys are fantastic. Combined with shift you have your word jumping feature. Then you just start actually editing _without_ switching mode. Wuhuu!
That said, vim is still cool enough for config files, small shell hacks, etc.
So far I must agree with anderstornvig. I spent about a week in Vim now. I definitely like the lightness of it which is perfect coming from a Mac/TextMate background.
I mostly write Python, JavaScript and PHP. However, while navigation in normal mode in Vim seems much easier than the emacs' Ctrl+B/F/P/N (arrow keys?! I'm trying to keep my hands on the home row thank you very much), it's the constant mode switching required when writing new code that has frustrated me immensely.
Add text, go up a line. Wait I have to switch modes first, gah I don't want to type "k". Undo. Gah. That undid my last typed text. Wait, that's the wrong indentation level. Should I type in a few spaces in regular mode or Vj and do Shift-. ? I don't know, I just want to type in some text!!
It's a constant battle! Any suggestions? I might have to check out emacs more but waiting around for it to load on my MacBook Pro takes about as long as waiting for something like Komodo or Eclipse to load.
Hey IMISSMYJUNO,
I am viming for a couple of years now. I no longer remember if I had initial problems with modes. Now the mode switching is in 'muscle memory', I don't have to think about it conciously. I guess it is like driving a car. You might get to this point after a while.
I followed pragmatic programmers' advice on "Learn you editor well": whatever editor you pick, try to do all your editing there.
Post a Comment