One thing I’ve never really understood is IDEs. I mean, I get it when you have a complex, emulated environment as a key part of your development. But for the majority of us who write in high level languages like PHP or Ruby, I just don’t see the benefit. Why use some mouse-y, graphics dependent piece of software when you can use the ubiquitous Vim?
I use Vim because:
- It can do everything any IDE I’ve seen can do. Syntax highlighting, code completion, easy documentation access and writing, debugger support…
- It’s available on every machine I work with (OSX/Linux/Unix) by default
- The configuration is portable, so I can have the same, totally customized environment on every machine I work with.
- It’s just way faster and more elegant than any IDE I’ve seen.
I’m open to learning new things, and if I’m missing out on some huge productivity benefit by sticking with Vim, I’d like to know about it. So this post will lay out my particular Vim setup, in the hopes that someone will comment with an IDE that could do more for me.
It’s worth noting that I keep all my standard configurations in a git repo. Specifically I mean my bash configuration, my ssh configuration, and my vim config. This means that when I set up a new machine, I can feel right at home with a simple “git clone”. IF you don’t do this yet, you’re suffering needlessly.
All this to say, bear in mind the big advantage that with one command, I can have my totally customized Vim “IDE” up and running on any serious (ie non-Windows) machine.
I love the customizability of vim. Here’s the first section of my ~/.vimrc file, which sets up the basic editor behaviors just the way I like ‘em:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
I also like the solarized color scheme:
1 2 3 4
These settings apply to everything I edit, no matter where, from Markdown to text.
I base my Drupal config on the great vimrc project for Drupal. It helped me get set up with Drupal API specific features like:
- syntax highlighting
- in-editor access to API documentation
- auto-completion (Vim’s normal PHP auto-complete enhanced with Drupal-specific keywords)
- integration with Drush, the Drupalist’s command line tool of choice
- code snippet auto-completion. For example, I can type hook_block, press TAB, and prepopulate implementations of all the block hooks, complete with documentation (doxygen) blocks.
This is easy enough to set up for yourself with a couple of Drush commands (see the project’s page on drupal.org), so I’m just going to leave the “tip of the iceberg” that actually shows in my .vimrc file.
1 2 3 4 5 6 7 8 9
I also have a couple of manually entered behaviors: double space for indents, and Drupal Coding standards in Syntastic:
1 2 3 4 5 6 7 8
Other IDE-like behaviors
I find I don’t need much more than this setup, but it is nice to have a file explorer. There are a few plugin options for Vim, but I always liked the built in netrw. I customize it using this snippet from detached head:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
I also like to improve the auto-complete behavior with this snippet from vim.wikia.com and linked pages:
1 2 3 4 5 6 7 8 9 10
I’m willing to look at “real” IDEs that can make my coding life easier, faster, and more efficient. But every time, I keep coming back to vim. Maybe it’s because it’s a part of my consistent environment everywhere. In any case, I’m interested in any ideas offered in the comments. :) So what alternatives should I check out? Or what could I do to make my Vim IDE even better?