As glamorous as the life of a co-contributor to a sort-of-kind-of-well-respected open source library is, I think one of the best perks is being able to cash in on the free, open source license of RubyMine. It took a bit of coaxing, mostly in the form of a lot of positive feedback from /r/ruby, and I was hooked after a few weeks.
A few weeks ago, though, I became mildly envious of my friends' at work who flew around the screens with Vim. I love keyboard shortcuts, always have, and the potential to make the editing process significantly faster was really attractive. Still, I love RubyMine's features, so... what was I to do?
Enter IdeaVim, the Vim emulator for RubyMine. Hallelujah, I have been saved! Real fast, I'll run through what I like best about this union.
RubyMine features I can't live without
- CMD + Click on any method to go to its definition, even if it's in a dependency.
- Right-click and there's an option to find all usages of a method.
- Highlight and CMD + Option + M to extract code into a new method. It finds variables and makes them arguments. Fuuuuck! So cool.
- YARD integration. If you annotate your methods, it will use the info to improve its code completion.
- The best find/replace/rename options I've ever encountered.
- Method calls get pointed out if I send the wrong number of arguments.
I know that's not much — it's sure as hell nowhere close to taking advantage of everything RubyMine offers — but they're all huge, huge game-changers. The thought of not having the ability to locate method source is brutal, I think it's a crucial option for anyone working with large codebases.
There are a few other features that are cool but just not for me. I use the test support on occasion but tend to want to run the same one or two specs repeatedly, not an entire file, so it's usually overkill. As for git, I find the CLI more comfortable, though its integration does seem fantastic. Finally, the Rails features are extremely cool but I rarely work with it, so they're lost on me.
Vim makes things faster
A lot of Vim users go crazy with plugins. It seems only natural, since every itch seems to be scratched by something that's very focused and sounds very helpful, but all that power comes with a steep learning curve. I think I'm mitigating that by focusing on the basics: fast movement around the screen and word/line deletion/replacement. You don't realize how much time you spend moving around the screen with some combination of mouse + arrow keys + ctrl/home/end until you start using EasyMotion (emacsIDEAs) in my case and get a hang of basic editing.
My Vim list:
- emacsIDEAs is insane. I have it mapped to (CMD + J)(CMD + F)(char I want to find). It highlights that character all over the screen, replaces it with a character (a thru z) and then I hit that character to jump there on the page. Stolen from Google: It takes a little getting used to but it's very precise, very helpful.
- Everything here. Everything.
That's it so far. It might not seem revolutionary but it's one of those "you-have-to-see-it-to-understand" things.
To those getting started with Vim + RubyMine...
I had some problems adjusting and still find some things a little annoying. My quick bullet-points for those who are new:
- Remap the hotkey that switches from insert to normal mode. I went with (CMD + j)(CMD + j). For some reason, I always have to hit another key — any key — after switching modes for it to register the change. Having to reach up to escape constantly was a real buzzkill.
- Remap emacsIDEAs basic word search. I went with (CMD + j)(CMD + f) and remember it like "jump" + "find". It's helpful because those two characters are always accessible.
- Don't be afraid to turn off Vim mode if you're frustrated. The nice thing about the plugin is that you still have RubyMine backing you, so it's not like you're going back to Notepad in its absence.
I imagine that if this post is read by anyone, it will be people considering the switch to either or both. If that describes you, my advice is to go for it but go slow, don't feel pressured to use every new feature at all once. While the Vim Master Race might push you to use ALL THE PLUGINS ALL THE TIME, I find that it's such a huge paradigm shift from a traditional text editor that a slow ramping up is helpful. Find the tools that are easiest to work into your workflow, gradually increase resistance. Right away, you'll find an improvement in your work, and in time, things will only get better!
For my next trick, I intend to get better with Vim away from RubyMine. I've been doing a bit with Rust lately and find the switch back to SublimeText like... barely a step up from Notepad, frankly, but I'm still struggling with folder navigation and window management in MacVim. It's a process, I'll get there.