Stick around code nerds long enough, and we’ll start talking about text editors. Eventually, one might (or, if you’re discussing this on the Internet, one certainly will) bring up Vim. Ah, Vim: the text editor that many command-line users love.
Here’s what happened to me: I was looking into new software with which to write my articles and synchronize them to Evernote. Through a convoluted series of events which I shall not describe here, I ended up spending a couple of hours learning to use Vim. I’m so very glad I did. It might not be my go-to editor for every task, but it introduced me to a new text-editing concept that I didn’t even know I needed: Command Mode.
In short, Command Mode allows you to manipulate large amounts of text — be it prose, poetry, or code — with keyboard shortcuts. It’s designed so you never have to take your hands off the keyboard, if that’s your style. Once you’ve mastered it, it’s fast, efficient, and best of all: it makes you feel like such a nerd. It’s like taking your typewriter to Starbucks, but far more useful; and it induces less mocking laughter.
First, learn a little Vim
Integrating Vim’s Command Mode into your favorite text editor will do you no good if you don’t know the commands. There are too many to list here, and certainly too many for most people to memorize.
Vim’s own creators insist that the best way to learn to use the program is by using it… with a little bit of guidance. To that end, Henrik Huttunen created this Interactive Vim Tutorial. Go check that out; and learn some of the basic navigational and text editing commands.
When you’re ready, come back and I’ll tell you how to set up Command Mode in a couple of different text editors/IDEs.
Second, integrate Command Mode with your preferred tool
Sublime Text
Sublime Text actually comes with a form of Vim’s Command Mode built-in. It’s called “Vintage Mode”, and you can easily enable it by editing the user settings file. In the section called “ignored_packages” just remove the text that says “Vintage Mode”, but leave the quote marks.
Mind you, this only partially replicates Vim’s functionality. If you want a more complete experience, you need to install a package called “VintageEx” through Package Control. With that in place, all of the same basic commands seem to work just fine.
Brackets
There’s no built-in option this time, but as I expected before I even tried it, the Brackets extension community has you covered. Just open up the Extensions window, and search for “Vimderbar”. I know, I love the name too.
Komodo Edit
It’s funny how you never notice some things until you start looking for them specifically. Komodo Edit also comes with built-in Vim-like functionality. Just go to “Edit > Preferences > Key Bindings”.
You’ll see a toggle called “Enable Vi emulation”. Click that. You might be prompted to create a new Key Binding Scheme. Alternatively, you can just choose the Key Binding Scheme calle “Vi” from the drop-down menu.
(It should be noted that Vi is Vim’s predecessor. Other text editors might have more or less the same functionality, but they might call it “Vi mode” or “Vi emulation” instead of, say… “Vim mode”.)
Or try out Vim itself
If you want to get a real feel for Command Mode, you could try actually using Vim. You don’t even have to leave your comfortable graphical desktop environment if you don’t want to, and you certainly don’t have to use Linux.
On Linux and Windows, you can use gVim, or Cream. gVim is basically Vim in a window, and Cream brings you all of those comfortable graphical features you’re used to.