I switched from Vim to Spacemacs & Elixir. Here’s my config & reasons

Wojciech Ziniewicz
Stories imported from wordpress
5 min readApr 6, 2018

I have recently made a switch from vim to spacemacs. Spacemacs is basically emacs for vim users. Vim editing is great and you can still use you old habits while being on a most advanced and robust work environment that you can choose not to use at all.

First — some numbers

What I used before I switched to spacemacs: vim (Vundle, Neotree, ctrpl and usual plugins)

Languages that I use/code in on a daily basis: Ruby, Chef, Python (mainly), Elixir, JSON, Yaml, markdown

How much time to switch from vim to spacemacs: approximately 2 to 3 days for full productivity and approximately 30 mins to switch and start coding.

Is spacemacs good for you?

There’s a high chance that spacemacs won’t help you in your day-to-day work. First of all let’s define all known vim user groups. You are probably a member of at least one of them:

  1. I use pure vim without any modifications — I open and close it many times a day
  2. I use pure vim with custom .vimrc — I open and close it many times a day
  3. I use vim with plugins but I dont customize it (e.g. https://github.com/carlhuda/janus) — I probably make use of tags, ctrlp, nerdtree etc. and try to stay in the same project thruought the day
  4. I use vim with custom plugins, I use neotree, powerline, Git, neotree and all the good things. I rarely close my vim window.

So if you are a member of either 1 or 2 — spacemacs may be too much for you. But if you belong to 3 or 4, then you should definitely give spacemacs a try.

So why is it better for you?

I’ve been a member of 1st group between 1998–2004, 2nd between 2004 and 2006, 3rd between 2006 and 2013 and 4th between 2013 and 2018. This means that I’ve been using vim for 20 years.

Here’s what’s great about vim:

  • vim editing in ijkl mode
  • NerdTree
  • CtrlP (if it works)
  • It’s blazing fast
  • Unified editor on all environments (servers, my laptop, other people’s computers)
  • Everyone knows vim

Here’s what problem I always had with vim:

  • Nerdtree — although NerdTree is great, I always had problems with vim root following my NerdTree root to use proper ctags
  • Ctags — ctags are nightmare. It’s a separate being that runs somewhere in the background to regenerate something called “tags” which is basically a file that contains all your code parsed into an indexed form so vim can search thru it
  • Projects — vim doesn’t really haave a notion of a project so it’s hard to organize your work or do things like “replace X with Y inside the project”
  • Clipboard integration — so far I could not make yanked vim lines appear in my Ubuntu 16.04 clipboard (which is not true with gvim but even there you have to use special type of yanking)
  • It’s written in vimscript which is hard to read and you don’t want to touch it
  • Plugins are kind of separate beings and there’s hardly any integration betwen them possible (e.g. open ctrlp-ed file in an existing buffer and make nerdtree focus on that file)
  • It’s multi threaded (NOTE: this is both problem and a possible advantage)
  • Additional separate window (tmux/screen/terminal) — if you use vim, you always have to use either tmux, screen or few terminal tabs for running your project, running tests or evaluating code

I was always able to live with these problems but that was making me not love vim and not use it.

So finally, here’s what Spacemacs does better than vim (for me!):

  • No need for ctags — spacemacs has a built-in default for searching inside your project using SPC + / (yes — space and slash)
  • Projects — spacemacs uses something called “projectile” to manage your projects. This means that you can actually do stuff inside a project (e.g. replace or occurencies of X with Y)
  • Spacemacs is a coherent being. Whenever you open a file and it doesnt have support for it, it asks you whether you want spacemacs to modify spacemacs config by itself and install support for it #mindblown
  • Perfect clipboard integration with system and built-in clipboard history using something called “kill ring”. So whenever you copy (ctrl + c) something on stackoverflow, you can “pp” it in your code
  • NeoTree which is basically the same as NerdTree but it’s integrated with projectile so it understands your projects
  • It’s written in elisp which I understand
  • It’s ultra stable — vim has been quirky for me but spacemacs behaves better
  • It has a single config file under ~/.spacemacs which is slightly better than those fragmented Vundle, janus, post, pre vimrcs.
  • Last but not least — it makes me try to use and learn new useful features where vim wasn’t so kind and there was much more friction on each step
  • It’s insanely configurable — you can do basically whatever you want with it. Just like in vim but spacemacs architecture is somewhat easier to understand for me.
  • There exists only one source of documentation http://spacemacs.org/
  • It has magit. Magit is the end of your journey. It requires a separate post. It’s so great you will want to drop whatever editor you’re using and switch to spacemacs or emacs just because it has magit. Magit puts end to the “how do I rebase a branch without reflog while my stashed changes are having conflicts with origin?” Magit has all the answers for you. Just drop your current client and switch to magit.

Ok I know why spacemacs is great, but now tell me why it sucks

Honestly I don’t think there’s anything that sucks about spacemacs except for the fact that it takes time to learn it. It’s not an effortless task.

I’m interested in switching, what’s your config?

So default config is good for pretty much everything (I mentioned earlier that spacemacs will download support for new langs on the fly) but I you need good starting point, then this is my dotspacemacs-configuration-layers section:

dotspacemacs-configuration-layers
‘(
yaml
python
javascript
vimscript
ruby
vim-powerline
twitter ;; yes — I use twitter in spacemacs
spotify ;; yes — you saw it, now ditch vim and come to spacemacs
docker
emacs-lisp
markdown
helm
sql
syntax-checking
auto-completion
erlang
elixir
graphviz
git
org
html
colors
spacemacs-layouts
themes-megapack
version-control
(markdown :variables markdown-live-preview-engine ‘vmd)
)

So this wraps up my blogpost about Spacemacs. If you find it useful then don’t forget to mention it in the comments!

--

--