Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
From TextMate to Vim (artfulcode.net)
62 points by edw519 on Aug 3, 2009 | hide | past | favorite | 40 comments


Disclosure: I'm a lifestyle vimmer, and have often made additions to my .vimrc in the dead of night, having awakened in a feverish panic from a hypnagogic vision of some most excellent new macro that I absolutely MUST map to <Leader>k RIGHT NOW, before I forget how much it'll help when I'm trying to replace CamelCase variables in HTML files but only when I load their buffers on alternating Tuesdays and I'm in diff mode...

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.


Vim is nice, MacVim is nicer. It'd be perfect if it had the the project drawer from textmate on the side, instead of wierd-textmode treecontrols which i never quite master.


If you are referring to NERDTree, NERDTree is awesome!

  *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!


I second that, another useful plugin is taglist.vim, just make sure you have exuberant ctags installed first!


NERDTree is ridiculously awesome.


Try vimmate.. it is easy to install on ubuntu ;)


Try the vim plugin "fuzzyfinder_textmate"


Since discovering MacVim, have totally switched back over from TextMate.

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)


If you're into unsupported ways of extending OS X you may find Ciarán Walsh’s "TerminalColors" SIMBL bundle useful.

http://ciaranwal.sh/2008/02/12/terminal-plug-in-updates


Never could get that to work properly on my OS X box(es).

Might have been a legacy hangover from saved terminal setups dating back to Jaguar days…


I have been a hardcore Vi(m) user for the past many years. Over the years I have learnt the mastery of Vi editing and I love editing in Vi. But one thing is for sure: Vim (at least for Mac) sucks badly. The scripting language is a joke, the development is stalled (or really slow), the syntax highlighting is a joke and the implementation is really slow for some things. There is nothing worse than being slowed down by lags in the text editor. I have tried to switch over to Emacs for at least 4 times now, but unsuccessfully, since the editing is not that natural for me. (I know at least one other Vim hacker that has done and tried the same switch).

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


It's slightly ironic that BBEdit is dismissed as "lost in the pre-OS X" world by someone who went on to evaluate emacs and plumped for Vim•. Especially since BBEdit solves all the problems he had with TextMate.

(• 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)


Indeed; outside of emacs, it's my favorite editor.

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.


Even configuring Emacs through the .emacs file I find that it treats things different enough from Vim that it's painful to try and switch. Every once in a while I get excited that maybe I'll switch, but then I pretty quickly fall back to Vim.

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.


(assuming cc-mode) Set c-basic-offset to 4.

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.


Not being a huge lisp person, are there lazy-evaluating lists in lisp? So that I could define the tabstop sequence to be a list that would continually be evaluated, but only as far as the calling function was asking for (like Haskell)? Otherwise, there is still a finite end to the list even if I can easily generate a ridiculously long sequence automatically.


I don't believe there's anything in the Common Lisp standard for it, but I think lazy lists should be implementable with macros.


Nope, strict eval only. Just define a max, and if you hit it, raise it.


vim can give you more advantages if you have a wider screen. tab in tab, editing two file in the same tab, etc. it's very flexible. http://journal.kilabit.org/?p=81.


I switch back and forth between TextMate and MacVim. MacVim is slightly, annoyingly slow; TextMate feels more natural (including smooth, fast block editing without modes); TextMate doesn't have split view or buffers. To be honest, I'm not that happy with either. I've tried emacs a few times because Aquamacs is a nice app, but emacs makes my vim-trained brain hurt and I end up wresting with it and giving up.


MacVim is slow? Since when?


Compared to `xterm -e vim`, yes. By that measure, so is gvim and every other GUI vim wrapper. MacVim just comes with quite a few plugins, which may explain the commenter's experience.


Yeah but he was comparing it to TextMate.


I've been using Vim for work all summer, and returning to TextMate is a bit of a challenge for me. I guess it's time to make the leap to pure Vim!


I recommend checking out Komodo Edit. It has a really great vim emulation, and has all the nice IDE features that are useful (projects, file browsing, remote file editing). It has most of the nice things from Textmate (the Cmd+t quick open), extensions, and much more. Plus it's own snippet system as well.


"It has a really great vim emulation"

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.


That's absolutely the opposite of everything I love about vi -- that I neither need nor want to customize it!

I can sit down at a new Unix box 25 years in the past or future, and not be frustrated editing a file.


Usually people don't customize the 'core' bindings/functionality. It's usually about complementing it with things that make your life easier.


Exactly. I want :w and such to always do what they do. But I also want my assorted helper macros and mappings so I can avoid typing boilerplate code and so on.

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 tried Komodo Edit about six months ago. I really wanted to like it, but it was really just too slow (on Windows).


On OSX, at least, Komodo Edit was not a very polished experience for me.


After seeing Textmate crash for the thousandth time, I also made the jump back to VIM. Seems like a bit of a regression, but at least its stable and I dont have to worry that opening a large will crash every project I have open.


Lots of success stories from TextMate to Vim/Emacs lately. That's on my list too; I just need to force myself to make the jump (and allow for the short-term productivity hit).


It's worth it.

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


Amen. Once you get the hang of it, you won't know how you lived without it :)

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


Tip: Instead of :wq you can just type ZZ


I learned ZZ first. That turned out to be a mistake, because thinking of it as :wq crams more knowledge into one mnemonic. Because you can take it apart: you can just do :w, or you can just do :q, or you can do useful variations like :q!

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. ;)


Yes, when learning it it is useful to know that :wq can be decomposed in to :w and :q and combined in to :wq! and :w! and :q!

But once you know that I think it's simpler to just type ZZ


When you start, be sure to first go through the vimtutor (just type "vimtutor" in your shell).

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


TextMate-like snippets in Vim:

SnippetsEmu http://www.vim.org/scripts/script.php?script_id=1318




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

Search: