If you follow me you’ll notice that I’ve been playing with Vim lately. For almost a year now I’ve been a TextMate fan but something about Vim just called to me. Maybe it was the feeling that knowing Vim increased my geek cred just like terminal hackery does.

Vim and TextMate sitting in a tree
Vim and TextMate sitting in a tree

Why Vim

Really anyone doing any type of coding should be fairly comfortable in Vim (if you’re not I know a post on Vim). Vim is on any Unix system so it’s on all the servers you’re putting client sites on. If you have SSH access to your server Vim is way faster than FTP trickery.

Vim’s Killer Features (yeah I mean good things)

The feature I miss the most from Vim (when I’m coding in TexMate) is the modal editing. Just by hitting escape I’m moving the cursor around. Then start looking at using ‘W’ and ‘B’ to move whole words and you’re flying around the file so fast your hair will curl.

NERDTree is another pretty dang awesome Vim feature. Yeah I know it’s a Vim plugin but just go install it since it should just be included by default. NERDTress gives Vim a project browser like any other modern GUI text editor. You can move around with the normal Vim keys and open,close files lightening fast. It’s also super easy to jump to the parent folder and close it.

Vim’s Killer Features (as in your dead to me)

That dang copy/paste buffer. So you have a normal system wide copy/paste buffer that is pretty much the same no matter what operating system your on. Well Vim doesn’t care about that and it doesn’t use it. You see Vim has it’s own copy/past buffers that only work inside Vim (at least as far as I can determine) and the system ones don’t work. So that cool piece of code you put in your blog so you could reuse it, yeah it won’t paste into Vim, sorry.

No CMD+t to open a file in a project. While NERDTree rocks it’s still no CMD+t from TextMate. Sure PeepOpen adds that type of function to MacVim but not to Vim (and of course it couldn’t if you used it on a remote server).

TextMate go to file CMD+t
TextMate go to file CMD+t

Still Using TextMate

Really the only feature from Vim that I miss when using TextMate is the navigation of code with HJKL. There is a plugin that adds this to TextMate but I’ve found it a big buggy (lets just ignore the fact I’m on a hackintosh please). Well that’s not quite right I TextMate started having occasional issues getting stuck in the project drawer after I renamed a file, after I installed ViMate.

That’s All She Wrote

So I’m going to stick with both Vim and TextMate for now. Neither is quite what I’m looking for in a code editor. They both have awesome features and things that are a bit lacking.

At the very least if you’re working on code use Vim long enough that you’re comfortable in it. It just makes you a more well rounded coder. One day the time you spent in Vim will save your ass when you need to live edit some files on a live server that keeps dropping FTP but keeps and SSH connection. Trust me it saved my ass more than once.

8 responses to “I love Vim and Textmate”

  1. damienp Avatar
    damienp

    Hey Curtis. I just wanted to comment on the copy/paste buffer with vim. I think you’re right in that vim has its own copy/paste with yy and p, but it should be able to utilize your system buffer as well. As a sys admin I use vim daily and I have noticed some slight differences in linux distro behavior, but it should still work. (Now, I haven’t tested this on a hackintosh, but I know it does work on OS X (10.5) and on Linux). In linux you may have to use the CTRL+SHIFT+C and CTRL+SHIFT+V commands while on OSX it should use the standard COMMAND+V and COMMAND+C. While we’re talking about editors, might I suggest a peek at redcar? It’s very similar to textmate, but it’s written in JRuby (so it’s completely cross compatible) and it’s free (for those that like cheap).

    Cheers
    damien

    1. Curtis McHale Avatar

      I’m totally willing to acknowledge that this could be a bug in how the Hackintosh stuff works so it’s good to know that it ‘should’ work. I’ll have to dig deeper into the issue and see if I can come up with a solid repeatable use case that could be put to solid bug testing and thus hopefully fixing.

      As for redcar I’ve heard of it but never tried it. Since I’m always cheap 🙂 I’ll totally give it a shot, thanks for the recommendation.

  2. Scott Avatar
    Scott

    The system clipboard is accessible in the “+ register in Vim. So, “+y and “+p or “+P will copy to or paste from the system clipboard. I use this so often that I have a key mapping for both. I use y and p. This is what I have in my .vimrc file:
    nmap p “+p
    nmap y “+y

    Then, to use them, all you do is type your leader character, which I have
    remapped to “,”, which becomes something like: ,yW or ,p to copy and paste.

    :wq

    1. Curtis McHale Avatar

      I’ll have to try that out for sure. Thanks for the tip.

  3. Scott Avatar
    Scott

    The comment system removed the leader tag from the above code. Sorry.

  4. Gilles Ruppert Avatar

    I switched from TextMate to vim about 2 years ago and there is no going back for me.

    As for TextMate’s cmd-t: there is a vim plugin called command-T (http://www.vim.org/scripts/script.php?script_id=3025) that will fullfill that need. Also: I love using vim in Terminal, but for better desktop integration, give MacVim a go: you can select text & copy/paste from/to the system clipboard.

    My tip is: whenever you have an itch, search Google for a vim plugin. 99% of the time, the solution is already waiting for you.

    1. Curtis McHale Avatar

      Thanks I hadn’t heard about that plugin. Guess I’ll have to add it to Vim and see if I just love Vim now.

  5. Jack Kinsella Avatar

    I wrote a guide on moving from Textmate to VIM where I detail, side-by-side, actions in VIM and their equivalents in Textmate. You’ll find it useful.

    http://www.jackkinsella.ie/2011/09/05/textmate-to-vim.html