This is a brief about my Vim setup and how can one start using the awesome features of Vim. Not an actual tutorial. Just insights about what Vim is capable of and showcase of my setup.
For beginner tutorial, visit openvim. Moreover, Youtube has a ton of screencasts about it.
Vim has a special key, called the
leader key. This can be any key on your keyboard. I’ve chosen
, as my leader key for it causes least strain on hands, and is not frequently used. You can use combinations of keys with leader key to create many custom shorcuts. Find more at my vimrc.
This is the configuration file for Vim, located in your home directory. Here, you can place your customisations like keyboard shortcuts, color schemes, plugins, etc. This is the first file processed after Vim loads.
Vim can be interfaced with Plugins which can add features like file browser, syntax checking, git, and many more. Vim Awesome is a great place to find plugins.
To install any plugin, click the link and follow the instructions on their README.
MVP (Most valuable plugins) (for me :P)
- Nerdtree: Provides a directory tree on the left.
- Nerdcommenter: Comment and uncomment multiple lines at once.
- Autopairs: Automatically pairs brackets, quotest, etc.
- Syntastic: Real-time syntax checker. Highlights possible errors in code, like variable type, return value etc.
- Neocomplete: Auto-completion based on open files.
- YouCompleteMe: Autocompletion for almost any language, even libraries.
- Vim Airline: Status line at the bottom of your window, with short details about your environment.
Here’s a view of my plugins in action:
Want to try my vimrc?
- Download Vim. On Debian/Ubuntu,
sudo apt install vim vim-nox
- Download it here. You can refer to comments in the file for references.
- Install Vim Plug.
- Open Vim, and then type
- Wait for things to set up.
- If you have installed YouCompleteMe, download this file to ~/.ycm_extra_conf.py.
You can modify this file to suit your needs for C/C++.
YouCompleteMe can take considerable time to build after install. However, that is one-time. You can comment the lines regarding youcompleteme to make things fast while setup.
Don’t freak out at the lines at the end of vimrc. I’ve too used the snippets available on the README pages of the respective plugins.
Requirements vary from person to person. Tweak things as you need.