Configuring Vim as an IDE

20 Apr 2017

VIM is the infamous text editor(only?, think again!) which I was scared to use initially. It is too overwhelming for new programmers. Fortunately, or unfortunately, I had to do software development and testing inside a Virtual Machine for a particular Open Source software. When I say inside a VM, basically, all I get is the shell of that machine.

Wait, only shell? So, No GUI?
Yes. So no fancy GUI based text editor or IDE. So, I had to choose between the terminal based editors: Vim, Emacs, Nano.

Now, there are holy wars fought around the world for choosing the best among them. I’m not going into that. I’ll let you choose for yourself. Here, I chose Vim as my primary editor. Vim is highly configurable and powerful. There are tons of smart programmers who have written various plugins for making Vim awesome.I, here, have tried to configure it according to my use. This configurations will evolve as time progresses. Let us first go through the initial steps to get started, after which we can get into the details.

Note: I’ve used it only in OSX and debian based Linux distro. I use iTerm2 in Mac and for linux, I SSH into the Virtual Machine. Make sure that VIM version >= 7.0.

  1. $ git clone https://github.com/souravchk/dotfiles.git
  2. $ cat dotfiles/vimrc > ~/.vimrc

OR Simply paste this file into ~/.vimrc

The ~/.vimrc file is the configuration file for vim. Whenever vim starts up, it is going to behave in the way this files tells it to. All the commands settings and the plugins that we will use, will be stated in this file. Now that we have the vimrc file, let us do the needful to download the plugins.

  1. For managing our plugins, we will first include the plugin manager, Vundle. This makes our task a bit easy. For analogy, we can say that it just works like pip for python.
    Do;
    $ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
  2. sudo apt-get install exuberant-ctags for Linux users.
    OR
    Mac Users can download it from this link.
    This will be helpfull for tags generations. This is a pre-requisite for the Tagbar plugin that will use.
  3. Download this font. This will give the Plugin airline a classy look because it requires patched fonts. This font is one of them.
  4. For debian-linux, one might have to add support for unicode characters.
    echo "set encoding=utf-8 nobomb" >> ~/.vimrc.

After downloading the pre-requisites, We can install all the plugins through the ~/.vimrc file.

From terminal you can run vim +PluginInstall +qall.
OR
Open Vim, then :PluginInstall and enter.
After this, when you open Vim and press in normal mode\b, it should look like this.

Screenshot

The following plugins have been used in my ~/.vimrc. You can go through the documentation of them to know there usage and the nitty-gritty.

  1. Vundle
  2. vim-airline.
  3. vim-airline-themes
  4. vim-colors-solarized
  5. nerdtree
  6. vim-nerdtree-tabs
  7. syntastic
  8. vim-misc
  9. vim-easytags
  10. ctrlp.vim
  11. a.vim
  12. vim-gitgutter
  13. vim-fugitive
  14. delimitMate
  15. vim-tmux-navigator
  16. vim-colorschemes

This is a ever-evolving list and config for the VIM. The more you use, the more you get near mastering it.