April 27, 2019

For the Vim crowd, my .vimrc file is available on Github.

I got introduced to Vim 7 years ago. Getting started with Vim was a challenge. I think it was a typical experience: Vim has a steep learning curve and requires lots of customization to hit that nice spot. There is even a cost to start typing actual text. As I’ve never been introduced to a Vim-like model, my intuition for a text editor is to just start typing. When you opt for a new experience to increase your productivity, it is hard to be convinced to hit a key to start typing. It seemed counter-intuitive.

That made me bail of Vim multiple times. But I always had the inklings to give it another shot. I think a part of it is “jealousy”. Seeing other developers wrangling code in unusual ways, I wanted to have that kind of power. Also, carpal tunnel syndrome is real and I needed to relieve my hands of constant switching.

It is fair to say now that I’m comfortable enough with Vim. Vim was a game changer and had a significant impact on my productivity. I can see that the time spent on configuration and customization has been paying off dividends.

I rely heavily on Vim and though I made it sound like it is all roses; I do have some frustration. The editor has some considerable shortcomings; especially if you are expecting an IDE-like experience. The process of augmenting Vim to be able to support proper code formatting is rather expensive. That’s something you get by default in most of the IDEs out there.

The most annoying of these were:

You don’t get proper language support; even for formatting. The default formatter is very basic and language agnostic. You’ll have to install different plugins for different languages.

Usually, there are different competing plugins for any particular language. You’ll have to make a decision of what is best for you.

Many plugins require external programs to function. They also need to be able to call these properly from Vim. It can be a challenge to get that working properly and the documentation might be lacking.

Syntax checking is still lagging and years behind what most IDEs will offer you. This is, of course, my opinion.

Lately, I’ve been diving into Rust. So my Vim configuration has been getting accommodated accordingly. It makes this configuration a bit biased, though you can make use of the keyboard shortcuts and other goodies.

Here is a sneak peek of Vim in action.

Image 1: Splitting and switching windows.

Image 2: Alternate between NerdTree and TagBar.

Image 3: Easymotion to navigate through text.

Image 4: Autocompletion for Rust.

Some of the custom shortcuts I added to Vim.

jj on insert mode to switch to command mode.

on insert mode to switch to command mode. Arrow key are disabled and instead they resize the current split window.

tab to move between buffers

to move between buffers space + x to close the current buffer.

+ to close the current buffer. F to auto-format code. For Rust, it calls the rustfmt formatter.

to auto-format code. For Rust, it calls the rustfmt formatter. Double space to toggle between fast and slow scrolling modes.

to toggle between fast and slow scrolling modes. C moves to visual mode and select the text between quotes.

moves to visual mode and select the text between quotes. X move to visual mode and select the text between brackets.

move to visual mode and select the text between brackets. W move to visual mode and select the current word.

move to visual mode and select the current word. B to select the text inside a Tag, and V to select the whole tag.

to select the text inside a Tag, and to select the whole tag. cc to comment/uncomment a block of code.

to comment/uncomment a block of code. nj to toggle the NerdTree window.

to toggle the NerdTree window. nk to toggle to Tagbar window.

This is not an exhaustive list, but these are some Vim plugins that I’m relying on.

vundle: Vim plugins manager. A must-have.

rust.vim and racer vim: Add formatting and autocomplete support for Rust.

NerdTree: File explorer.

Vim colorschemes: So you can pick a nice color combination easily.

Vim Easymotion: Allow you to jump through text with easy.

I don’t think my Vim setup is anywhere close to maturity.

Documentation : The Readme file could be improved. There are several steps to get the final Vim functioning which are not documented throughly.

: The Readme file could be improved. There are several steps to get the final Vim functioning which are not documented throughly. Source Control : Make frequent use of Git. It helps to remind what did change and when. It can also explain why some of these changes were made.

: Make frequent use of Git. It helps to remind what did change and when. It can also explain why some of these changes were made. Docker : It’d be great if I can run my Vim instance through a Docker container. It’ll make the install process easy and ubiquitous. I’m yet to try that and not quite certain of the volumes/files handling and performance.

: It’d be great if I can run my Vim instance through a Docker container. It’ll make the install process easy and ubiquitous. I’m yet to try that and not quite certain of the volumes/files handling and performance. Language Server Protocol : I think this could be a solution to the auto-complete and syntax checking mess. Along with a containerized Vim instance, it might be possible to finally have several popular language on functioning and stable auto-complete.

: I think this could be a solution to the auto-complete and syntax checking mess. Along with a containerized Vim instance, it might be possible to finally have several popular language on functioning and stable auto-complete. Undo and Redo: Currently I only use u to undo the last action. I think this is an area where things can improve.

315 Kudos