Using vim Effectively

One said vim is dead, but I quite disagree. The power of the modern IDEs like Visual Studio Code or Atom cannot be ignored, but there are lots of developers, administrators out there using vim as their primary interface. Even if it is not the primary one, there can still be an improvement to use vim more effectively. Here vim plugins run to our aid. I personally use vim a lot and have a "must-have" plugins. I wanted to keep them in a Git repository and I believe the best way is to add all plugins as git submodules.

Let me list down my "must-have" plugins below and thank their developers, contributors:

I personally use pathogen to install and use the plugins so the way how you will edit your .vimrc file is one of the most important things. I am currently using a simple one but I add more in the future to make my life easier

.vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
set nocompatible      " We're running Vim, not Vi!

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
set number
set cursorline

setlocal tabstop=2
setlocal softtabstop=2
setlocal shiftwidth=2
setlocal autoindent

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0

" Lighline plugin activation
if !has('gui_running')
  set t_Co=256
endif
set laststatus=2

" Python indentation
syntax on
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=4
filetype plugin indent on
set autoindent

" Ruby indentation
syntax on
autocmd FileType ruby setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2
filetype plugin indent on
set autoindent

" YAML indentation
syntax on
autocmd FileType yaml setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2
filetype plugin indent on
set autoindent

" Bash indentation
syntax on
autocmd FileType bash setlocal expandtab shiftwidth=2 tabstop=2
filetype plugin indent on
set autoindent


" auto indent by F7
map <F7> mzgg=G`z

" Paste mode on / off by F2
set pastetoggle=<F2>

" vimdiff coloring change
map <F6> :windo set syn=OFF<CR>

" Nerdtree open side menu by "ctrl-o"
map <C-o> :NERDTreeToggle<CR>

Last updated