Going Vim
Vim or “Vi Improved” is a text editor that works in every terminal. Some people even consider Vim as the best text editor for programming. However, many people are also intimidated with its steep learning curve. Vim is a terminal-based text editor which means everything are operated through keyboard keys, there is no need to use the trackpad or mouse. This is actually what makes Vim powerful. One does not need to take their fingers off of the keyboard when writing in Vim. Yet, this is what exactly the pain when learning to use Vim, the notion of doing everything solely by using combination of keyboard keys is intimidating at best and frustrating at worst.
I’ve been using Vim on and off since several years ago for light text editing, e.g., writing
commit messages. Once, I tried to use it as my main text editor for programming after seeing
a colleague of mine who wrote (mostly) anything using Vim. But, I got frustrated due to the steep learning
curve. My productivity plummeted dramatically as I had to search for commands that I wanted to
perform, even for navigating up and down through the document was frustrating at that time.
Despite all of that, I became hooked with Vim’s key binding to move cursor (h, j, k, l
) instead
of using arrow keys thanks to the Learning Vimscript the Hard Way series (though I never completed the series)
. Fortunately there’s a Vim plugin for Atom and Sublime Text to emulate Vim’s key binding inside each editor.
I was a happy Atom user until October last year when I got a new laptop from my workplace. Syncing Atom was quite cumbersome task to perform even though there’s a plugin to help the process. Another fact was that Atom was quite heavy for the new laptop which run Ubuntu, to add to that, updating Atom in Ubuntu is not as seamless as in OSX, i.e., need to reinstall the package. Then, I remembered that I am a part-time Vim user, so I thought it was the right time to be a full-time Vim user.
After more than six months using Vim exclusively, I personally think it was the right decision.
Setting (syncing) up Vim is considerably painless with an online .vimrc
. After being synced,
I will have the same plugins, same custom key bindings, same shortcuts and same look and feel to
the Vim I have been using in the other machine. And since I’ve been using Vim’s key bindings for
quite sometime (in Atom), switching fully to Vim was not a problem not before.
Plugins
Here’s some essential plugins that I’ve been using in daily basis:
- vim-plug, a minimalist plugin manager for Vim
- neocomplete, keywords completion system for Vim
- vim-airline, lean and mean status/tabline for Vim
- vim-gitgutter, show a git diff it the gutter
- vim-surround, quoting/parenthesizing made simple
- lexima, autoclose parentheses
- syntastic, syntax checker for Vim
- vim-javascript, JavaScript bundle for Vim
Through these months, I also find some plugins that are great but not really suite my use cases:
- nerd-tree, a plugin to explore filesystem just like other
IDEs do. This plugin is awesome, but it slowed down Vim in my laptop. So I ended up using the native
netrw
module as mentioned in this vimcasts episode - tern_for_vim, a Vim plugin that provides Tern-based JavaScript editing support. Tern provides an intellisense for JavaScript editor including autocompletion on variables and properties, function argument hints, finding definition, etc. It sounds promising, right. However, my experience was that the plugin also slowed down Vim in my machine (or maybe I did not configure it correctly).
Enter tmux
tmux
is a terminal multiplexer which allows user switch easily between several programs in one
terminal. tmux
comes to light when I was searching for alternatives of iTerm in linux that support
split screen. tmux
provides the functionality that works in any kind of terminals both in Linux and OSX.
Ultimately, one of its most awesome feature is its ability to attach and detach session. I do not need
to be frustrated when I accidentally close my terminal tab or window as I can attach a new terminal
to the closed tmux
session. tmux
comes with a manageable learning curve compared to Vim’s.
Thoughtbot’s tmux crash course is a good resource to learn more about tmux
.
Even though Vim has a steep learning curve, the productivity gained pays it off. One thing I could recommend for new Vim users is to first use Vim binding plugin in your current editor. After feeling comfortable, you can try to switch full-time to Vim. Or, if you brave enough, then jump directly into Vim ocean might be the shortest way to master it. One thing for sure, the journey is just starting.