I recently decided to make the switch to VIM as my primary IDE. Any serious developer that uses Linux as their primary OS should be using VIM to edit their code, right? I mean, why not?
The IDE you use is really just a matter of preference. If you want to try out VIM as your IDE then maybe this post will help you, I’ll try to keep it short.
VIM Plugin Management
You will want to find VIM plugins that make developing on VIM easier. But first you need to decide what plugin manager you want to use for VIM. I decided to use vim-plug by junegunn because it was the most highly recomended. There are many other options so do your own research before you decide.
Vim-plug is easy to use, once you have it installed you just need to these two lines in your ~/.vimrc file:
call plug#begin('~/vim/plugged') " -- this is the location where vim-plug should be installed call plug#end()
Installing plugins with vim-plug is straightforward. You just need to put the github URL of the plugin in between the two lines above prepended by Plug. It would look like this:
call plug#begin('~/vim/plugged') " -- this is the location where vim-plug should be installed Plug 'scrooloose/nerdtree' " -- I will explain these plugins in a minute Plug 'vim-airline/vim-airline' call plug#end()
Once you have the lines added then you need to open a new instance of VIM and run :PlugInstall. That will check if there are new plugins in the ~/.vimrc file and install them.
Which Plugins to Use
This is 100% a matter of preference. If you want to go as barebones as possible then you technically don’t need any plugins. I prefer my IDE to have certain functionality such as buffer tabs and xdebug support.
Here are the plugins I am currently using:
- altercation/vim-colors-solarized: Provides a VIM color scheme.
- vim-trailing-whitespace: Whitespace management.
- scrooloose/nerdtree: Provides a file tree for easy navigation.
- Xuyuanp/nerdtree-git-plugin: Indicates files in the file tree that have been modified.
- ap/vim-buftabline: Shows open buffers in tabs.
- vim-airline/vim-airline: Displays a status bar at the bottom of the VIM window.
- vim-airline/vim-airline-themes: Provides additional themes to the airline status bar.
- taglist.vim: Provides a navigator for your open file.
- junegunn/fzf: My favorite fuzzy finder.
- junegunn/fzf.vim: Provides FZF support in VIM.
- joonty/vdebug: Multi-language debugger.
- airblade/vim-gitgutter: Displays modified lines in open files.
More VIM Configurations
There is a multitude of ways to customize VIM to function any way you want. Instead of going into all of the details, I’ll just show you all of the customizations I use.
This is not by any means the best configuration and I will try to post updates as I make changes. Without further ado, here is my ~/.vimrc file:
" ------------------ " Plugins " ------------------ call plug#begin('~/.vim/plugged') Plug 'altercation/vim-colors-solarized' Plug 'bronson/vim-trailing-whitespace' Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'Xuyuanp/nerdtree-git-plugin' Plug 'ap/vim-buftabline' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' Plug 'taglist.vim' Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' Plug 'joonty/vdebug' Plug 'airblade/vim-gitgutter' call plug#end() " -- solarized personal conf set background=dark try colorscheme luna catch endtry " ------------------------------- " Basic Configurations " ------------------------------- " -- tabwidth set to 4 set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab " -- highlight 80th column set colorcolumn=80 highlight ColorColumn ctermbg=0 " -- show line numbers set number " -- enable mouse support set mouse=a " -- set buffers to hidden for use with tabline set hidden " --------------------- " Key Mapping " --------------------- " -- NERDTree map <C-n> :NERDTreeToggle<CR> " -- fuzzy finder map <C-p> :FZF<CR> " -- taglist map <C-t> :TlistToggle<CR> " -- highlight search matches map <C-f> :set hlsearch!<CR>