Tom Gamon

Moving from Rubymine to Vim

I recently moved from Rubymine to Vim, which was quite a dramatic shift. I had a lot of questions on the way, and these were the answers I found. If you care why I changed, read the next section, otherwise jump to Warm Turkey.

Farewell, old friend

I love Rubymine. Or, at least, I did. The introspective qualities of being able to click to a definition (even if that is an external library) taught me a huge amount and the ease of having everything integrated into one seamless environment was a joy.

However, you can’t deny that it is a bit of a beast. When it is re-indexing files it can max out all your CPU’s, and it will happily hog a few GB of memory. This was becoming a pain as a slight shift in my role at work meant I was jumping between projects more frequently, and a change to a dockerised environment was adding it’s own overheads. It was time for a change.

This is what I was looking for in a my new editor:

  • As mentioned, I wanted to be able to jump into a project quickly and easily if I am trying to bring up an example or make a quick edit. Too many times I jumped into a project to demonstrate something, only to have my computer grind to a halt as it re-indexed.
  • I wanted something more configurable. I like being able to highly customise the tools I am using.
  • I wanted something lighter weight. At work we moved to a dockerised environment and a spare 4k screen came up for grabs. Running docker and 3 4K monitors is pretty intensive by itself.
  • I wanted something free.
  • I wanted something that I would ideally be able to use anywhere (within reason, I am happy to have a config file that I load). There are times when I want to work in a remote environment, and RubyMine is a bit tricky to use over SSH.
  • I like the idea of investing time in skills which will continue to pay back, and you can carry on investing in them for a long time - they don’t plateau early.

I tried VSCode for a while, but I never grew to love it. I think I always wanted it to be more of an IDE than it was being. I had dabbled in using Vim over the years as I liked the idea of being able to launch an editor super quickly, and was intreigued fabled productivity gains of all-shortcuts all-the-time.

Warm Turkey

My knowledge of Vim was largely limited to i and :wq.

Rather than going cold turkey, which would be unfeasible for work productivity reasons, I decided to use Vim for simple editing tasks, or just for a small amount of time each day, until I could edit files at a reasonable speed.

I found these resources super helpful for getting me up to speed.

This taught me about using vimtutor which was great. https://medium.com/actualize-network/how-to-learn-vim-a-four-week-plan-cd8b376a9b85

This article was pivotal in the way that I thought about vim commands. https://danielmiessler.com/study/vim/

And this article was awesome in terms of revealing some cool things I didn’t know it could do. https://medium.freecodecamp.org/learn-linux-vim-basic-features-19134461ab85

Easing the transition

These were the things that I missed from RubyMine. Most things I could have a similar functionality with plugins. I use Vim Plug for plugin management as it seemed the most straightforward for me.

A starter configuraiton

Whilst part of the beauty of Vim is being able to configure it to your uses, it can be nice to have a helping hand to get up and running. I used the basic vim config here to get up and running with. It gives you some useful shortcuts and some basic configuraiton that allows you to get up and running a bit quicker.

Needing to use a mouse sometimes

I found MacVim super useful. It allows you to use your mouse if you need, and gives you some menus for configuration.

Browsing a project tree in a way that made sense to me

nerdtree

Solid git integration

nerdtree-git-plugin

vim-gitgutter

vim-fugitive

ctrlp

vim-rails You can use :A to quickly switch from, say, a test file and the model it is testing.

Go to definition.

With vim-rails installed, using gf when over a defintition will generally jump to the right file.

You can also generate ctags in order to navigate methods etc. I found this article useful for setting it up: https://andrew.stwrt.ca/posts/vim-ctags/

Quickly run just one test or my open test file

vim-rspec

Automatic linting and formatting

ale

A good theme and syntax highlighting

gruvbox I like gruvbox as you can get it for iterm as well as for Vim, keeping things nice an consistent.

vim-polyglot Language features like syntax highlighting and indent support for most languages you care about.

vim-airline Undecided on this one, but gives you a nice statusbar with some useful bits and pieces

Open the current file on remote

vim-rhubarb

Simple way to change a single quoted string to a double quoted string

vim-surround

Comment out blocks

nerdcommenter