For the Vim crowd, my
.vimrcfile 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.
jjon insert mode to switch to command mode.
- Arrow key are disabled and instead they resize the current split window.
tabto move between buffers
xto close the current buffer.
Fto auto-format code. For Rust, it calls the rustfmt formatter.
spaceto toggle between fast and slow scrolling modes.
Cmoves to visual mode and select the text between quotes.
Xmove to visual mode and select the text between brackets.
Wmove to visual mode and select the current word.
Bto select the text inside a Tag, and
Vto select the whole tag.
ccto comment/uncomment a block of code.
njto toggle the NerdTree window.
nkto 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.
- 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.
- 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.
- 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.
- Undo and Redo: Currently I only use
uto undo the last action. I think this is an area where things can improve.