From VIM to Emacs (with help of spacemacs)

Now I have been a Vim user for quite a while now and some of the habits I have are fine grained into my muscle memory. For me, VIM is one of the greatest editors out there. I really love it and once you get used to some of its awkwardness, it's a really powerful tool.

Emacs has been on my radar for a while now. From what I've seen, Emacs is a way better at almost everything, except text editing. VIM key binding, in my humble opinion, are way better suited for text manipulations than Emacs ones and that was the reason for me to stay in VIM camp.

Recently I started to notice spacemacs mentioned here and there. I checked it out and one of it's "marketing" points was - "Emacs for VIM users". I was sold. Almost...

I tried to follow the instructions on spacemacs GitHub page and nothing worked... As you know, time is a valuable resource and I duped the idea in a garbage can.

After some while in a galaxy far far away spacemacs was starting to nag me again. "Come on people, I need work to do and I don't have time to learn the new editor and I don't want to spend half a day configuring it!" - My inner voice said. But, as I always do, I did not listen to it.

Brave new world of Emacs

The first issue I encountered after installing spacemacs was the fact that I needed to remove "stock" emacs version with the one I installed over homebrew. Otherwise, I did not see anything from spacemacs config appear. I mean, I don't even know how to quit that damn thing! So here are the steps I took (I do not provide warranty)

First I had to remove the bin of stock emacs:

$ sudo rm /usr/bin/emacs

And then link homebrew installed emacs:

$ sudo ln -s /usr/local/Cellar/emacs-mac/emacs-24.5-z-mac-5.7/bin/emacs /usr/bin/emacs

That got me going. after typing:

$ emacs

I got this beuty:

I lied! It was on the second launch of emacs that I got this screen since at the initial launch it installs all the necessary plugins.

So my journey began

First thing I wanted to do is some configuration. Since I am mostly a Ruby developer I wanted to enable some specific things to Ruby.

As tutorial mentioned, if you want to do configuration on spacemacs, it is recommended to copy a config template for customization. That's quite easy to do:

$ cp ~/.emacs.d/core/templates/.spacemacs.template ~/.spacemacs

From there, just follow instructions in Ruby specific documentation and you will be good to go.

As it turns out, spacemacs has a really neat way of configuration. It has "layers" that can be enabled. Ruby specific documentation is just a "layer" containing all the plugins needed for Ruby. Neat!

Sice I use monokai theme in vim I also changed the theme to 'monokai' by moving it as the first item in configuration array of themes:

 dotspacemacs-themes '(monokai

Now it looks better (At least for my bad eye):
Monokay theme

With all this stuff in place, I could actually start to code.

So why spacemacs is so great?

It's focused around space. Really. In VIM I had my leader key mapped to ,. In spacemacs everything is focused on SPACE or SPC as it is reffered in the spacemacs docs. Think of SPC key as your leader on steroids.

Let's see example of what I mean:
Keyboard shortcuts

Once you press SPC you will get the list of hints. It seems intimidating at first, but belive me, this is awesome.

For example, to switch to next buffer, just press SPC b n and spacemacs holds your hand if you ever get lost.

Fuzzy search

One of the most frequently used plugins for VIM for me is CTRL+P plugin, which allows me to do a fuzzy search. In spacemacs, it comes preinstalled thanks to this thingy called Helm. Just press SPC p f and this appears:
helm search for file

Ruby specific stuff

I am really used to switching between my test files and implementation files. Spacemacs helps here as well. Press SPC m r g p and you are there.

Want to go to the file of definition under the cursor? No problem SPC m r g . will do the trick.

There is a lot more where it came from

What about the VIM, when that comes in?

You just simply use the same keys in spacemacs as you would do in VIM for manipulating the text. You will fell straight at home but on steroids. If you press :, it will take you straight to your lovely VIM like the command line.

Honestly, I do not feel that there is anything missing at this point in terms of text manipulations. It's one of the most feature complete VIM "emulators" out there.

To do:

I am yet to figure out a nice way to interact with my binding.pry statements inside of spacemacs and how to deal with copy and pasting from the clipboard. Those are only blockers I see at this moment to make a full switch. I'll be exploring it and will share my experience as I go along.