Vim World

Tips and tricks to get started with VIM

Posted by Nivin Anton Alexis Lawrence on June 3, 2018

Recently by the same author:


Introduction to Functional Programming [Part 2]

Think Functional


Nivin Anton Alexis Lawrence

Human

VIM

I always wanted to understand why many developers use VIM even when modern IDE is so sophisticated and can make the development environment so rich and easy. But, I was wrong and I’m happy that I realized this sooner than later. Here are my reasons on why developers should try out VIM

  1. It’s lightweight.
  2. You have complete control of the editor.
  3. Any plugin you think of, it’s available already.
  4. No to trackpad.
  5. Strong developer community.

Components to VIM

To configure VIM all you need is vimrc file. You define all your plugins, mappings and color schemes there. The way I define my vimrc is by splitting them into five components namely,

  1. init.vim
  2. plugins.vim
  3. mappings.vim
  4. theme.vim
  5. misc.vim

init.vim

Think init.vim, as a set of the instruction set that’s applied to all files. For example, displaying number lines, ruler, smarttab can be thought of instruction which you need irrespective of file type.

plugins.vim

As the name suggests, its where you put all third party plugins you need. Usually, plugins are installed through a plugin manager. I use plug.vim as the plugin manager.

plugins to consider

* fzf
* ycm

mappings.vim

Vim is popular for the modes it offers. To understand more about the modes, refer vim wiki. Many times, you switch from insert to normal mode. The default key binding is ESC, you can change that to jk and command used it :imap jj . Many such mappings that increases your productivity can be placed under this section.

theme.vim

Commands which are used to change the graphical interface of vim without side effects.

misc.vim

Anything that doesn’t fit the above categories come under this section. Things like auto-completion for python, syntax highlighting for c++ are the candidates that need to be put under misc.vim.