If retro mailing list flame-wars taught us anything, it’s that the advent of the personal computer provided mankind with a great unanswered question. A question that should rightly take it’s place amongst those other great questions such as “If a tree falls in a forest and no one is around to hear it, does it make a sound?”, or “Which came first, the chicken or the egg?”. That question is of course, “emacs or vim?”.
I regret to inform you that if you’re looking for the answer to this great question then you have yet to stumble upon the holy grail, my friend. However, if you’re looking for a random guy trying to boost his productivity by using vim, then you may just be in the right place…
Inspired in part by articles like “The Vim Learning Curve is a Myth”, as well as witnessing the productivity of a few colleagues over the years, I’ve decided to “learn the editor that beeps a lot”.
In the workplace I’ve often found myself the butt of a running joke - see, I’ve always been the kind of guy who accidentally opens a file in vim, hears beeping and mutters “Oh well, that’s that file lost then” whilst sighing. I’m sure I’m not alone either..
I’ve set out with the best of intentions to get to grips with vim before; I mean how complex can a text editor be? Apparently the answer to that question is “pretty damn complex” as it happens.
Still, as someone who - on a day-to-day basis - finds themselves logging in to various boxes over SSH, editing config files in virtual machines, as well as having 5 terminal tabs open and as many text editor windows… perhaps now is my time to finally get a grip of the dark art of vim.
It feels quite amusing that vim - as a text editor - has such a wide range of materials available online to help you “learn it”. I’m not sure about you, but I’ve never needed to “learn” a text editor before.. even most IDE’s I’ve used have been quite easy to fathom out!
Supposedly the best introduction to vim is the tutor -
vimtutor - and the good news is, if you have vim installed then you almost certainly have
vimtutor installed too. (I believe it’s simply an alias for vim to open a specific file)
It took around 30 minutes to progress through those lessons, and they served as a good introduction to navigating with the cursor, basic editing, searching and so on. It’s still very superficial, and quite clearly just scratches the surface, but it does get you in shape to begin using vim properly. Another interesting progression for getting to grips with vim is “Learn Vim Progressively”, which I’ve pinned to a tab in Chromium.
Adhering to tutorials and plans can be quite dry though, and although I’m not much of a gamer (read: I bought an Xbox One for FIFA, and that’s it.) - I can see that VIM Adventures looks like quite a fun way of gaining some habits too. (It’s worth mentioning OpenVim as another online tutorial experience.)
Lastly, I’ve printed off a couple of basic cheatsheets I found online here. I’ll simply pop these in my bag with my stationary when heading in to any client locations, whilst leaving a spare set pinned to my own office wall.
A few nice-to-haves
Not being known for doing things by half measures, I decided to go all in and look at the best ways of making the most out of Vim. The first thing I found was “The Ultimate .vimrc”… this is awesome.
As someone who writes a lot of Markdown documents - this post included! - the thought of getting to grips with Vim whilst writing my blog posts was quite attractive. As a huge fan of the “distraction-free” writing concept, I was pleasantly surprised to learn about the incusion of goyo.vim in the
.vimrc configuration above. This is quite possibly the nicest method of writing markdown documents that I’ve found.
I also wanted a way of enforcing the muscle-memory and habits of using vim, even if I was using another text editor. For non-code related tasks I often use Sublime Text 3, so I was happy to find the Vintageous plugin which provides Vim emulation in Sublime. Apart from a few quirks, it seems to be working fine.
I must admit that this hasn’t been completely plain-sailing though - and as a result I’m very reluctant to use vim on client work whilst I’m getting to grips with it.
Thankfully I haven’t lost anything! However, during the first couple of hours I kept hitting “Ctrl + Z” out of habit - forgetting I was in a terminal. This would lead to a couple of seconds of “Ohhhh shi…” until I’d realise what had happened. (Ctrl+Z in Linux will suspend a process, placing it in the background)
On the other hand, it has instilled in me a marvellous respect for regular saving (’:w’) quite early on.. so every cloud has a silver lining.
Progress, and next steps
I’m only a few hours in to my vim adventure, but already I’ve typed this blog post, wrote some technical documentation, drafted emails, and so on.. in total, I’ve probably put a couple of thousand words through it. I already feel fairly confident with the basics though.. in spite of the uncomfortable incidents mentioned above!
Things like navigating with
(/) have come relatively easily - as has context switching between different modes… at one point I even did some text selection and copying/pasing!
So I feel proficient using vim as a text editor at the moment, but ultimately the plan is to begin using it as an IDE within the coming weeks - by using features like tabs. Wish me luck!