From TextMate to Vim
artfulcode.net
artfulcode.net
This article is a reasonable assessment of vim, with what I consider to be some novel surprises. For example, he apparently found its configuration simpler than emacs: maybe he just hasn't tried it yet! Also, he considers it less distracting. I found this interesting as well, because he mentioned expertise in emacs as a journey rather than a destination. I have found this to be patently true for vim.
Still, I'm glad there are still people out there who are converting to vim. I'm puzzled by this particular blogger's experience, but maybe he'll find the traditional gotchas in due course as he continues to use it.
*C* (that's capital C), to switch the folder under the point to root
*r* to refresh
*m* to perform (or pick) a file system command
*cursor-keys* to move up and down
*?* for help
How can you not master that! Vim is awesome!Especially since I upgraded to Ruby 1.9 and many bundle actions no longer work in TextMate.
MacVim won me over (as I never really totally departed from Vi/Vim) as with MacVim, now I can have (a) full color color schemes (never could get more than 8/16 colors on OSX terminal session), (b) fullscreen (no menu bar, dock) editing, (c) OS X hotkeys (i.e, Cmd-W, Cmd-O, Cmd-N, etc.…) and (d) printing (which is fubared in TextMate)
Might have been a legacy hangover from saved terminal setups dating back to Jaguar days…
If I was to invest shit loads of hours into learning to use a text editor I would pick Emacs - - simply because the environment that Emacs offers is amazing (Vim environment looks good, but the more you customize, the slower things get and the more you look around, the more issues you find).
(• This isn't a diss of Vim or Emacs, btw, just that they're both rather less "OS X era" than either BBEdit or Textmate -- but that's often a strength)
It is (IMHO) exactly how a GUI-based text editor should act. Simple and unintrusive in normal use, with enough power under the hood (and accessible via UI) to do the tougher stuff. I still miss some of the things I could do easily in it, even with emacs 23.
As for the article's comments on emacs, the mistake is in assuming emacs is an application. It's not. It's a lisp environment that's been shaped for text editing. The configuration interface is terrible because you're not really supposed to use it. Instead, you shove programmatic commands into .emacs to bend it to your will.
Friends and I brag about the length, complexity, and age of our .emacs files... maybe we should get out more... but you get the idea.
There are so many things in Vim that 'just make sense', at least to my way of thinking. Things like tabs. Why is it that in Emacs you can't just define a soft tabstop of 4 spaces? Why do I have to define a list of column numbers? Don't get me wrong, the idea that I could manually define a bunch of column numbers so that the tabstops were uneven for a particular application would is cool... by why can't I just say "every 4th column is a tabstop" and have Emacs apply that until infinity columns? And there is the lack of things like Vim's ":set list" mode to quickly visualize if a bunch of spacing consists of tabs, spaces or a mixture (and to quickly figure out where trailing whitespaces are).
These are all things that I can get on default Vim without any configuration. I'm sure these are all programmable in Emacs -- it is a full-on lisp engine afterall -- but it's too steep of a climb for me (or at least has been thus far) when I'm already productive with Vim.
Even better, if you don't like the way anything's indented, move the cursor to that spot and hit C-c C-o and it'll tell you why it's indented that line that way, and you can adjust those parts as you wish.
If you're not in cc-mode, then.. it's lisp. Repeating sequences of multiples of 4 are pretty easy to write in a function that generates them.
Will it read in my .vimrc file and my custom scripts? That's the big win with vi for me, that I can customize and automate things.
I can sit down at a new Unix box 25 years in the past or future, and not be frustrated editing a file.
NetBeans has a vi plugin, which isn't bad, but I'm forever trying to do things that are only defined in my resource files and plugins, so I end up editing code in vi and using NetBeans for specific tasks (GUI editing, usually).
I did it last year, and it took almost two weeks before i felt like i was even somewhat productive again. However, now, i feel exactly the same way when trying to use an editor without a VIM mode. What? I have to use the arrow keys to move the cursor? But, i'll have to move my hands! sigh
In fact, it'll start taking over in how you interact with your whole coputer. I find that I type "<ESC>:wq" in chat windows, comment boxes, etc..
And you can probably do all kinds of other powerful stuff that I don't understand, because I'm an emacs user who only uses vim on occasion. ;)
But once you know that I think it's simpler to just type ZZ
Then, if you have questions, come to #vim on freenode. There are lots of very, very experienced and knowledgeable people there that will be happy to help you learn.
Then, if you still need more, there's:
Vim tips wiki: http://vim.wikia.com/wiki/Main_Page
The best collection of vim scripts: http://www.vim.org
SnippetsEmu http://www.vim.org/scripts/script.php?script_id=1318