Recommended vim plugins
Originally published
Last modified
Plugins sound like overkill for vim. Are they?
Vim has a built-in plugin loading system; it just doesn't manage downloading and updating plugins.
This has resulted in various Vim plugin manager plugins.
So do plugins inherently go against the nature of Vim? The answer is a firm "no".
However, Vim still has built-in limitations. It is a deluxe text editor, not a fully-fledged IDE. Trying to turn Vim into an IDE is a rabbit hole that goes against the principle of working with your tools, not against them. Just use plugins to enhance the Vim Way.
The best plugin manager is vim-plug
.
Setting up vim-plug
This snippet makes bootstrapping vim-plug easy; you don't need to download anything to any specific directory; just copy this to the top of your vimrc and it will set itself up.
" Bootstrap plugin manager and plugins
let root = '~/.vim'
" Make vim dir if it's missing (for brand-new setups)
for dir in ['backup', 'tmp', 'undo', 'autoload']
if !isdirectory(expand(root.'/'.dir, 1))
call mkdir(expand(root.'/'.dir, 1), 'p')
endif
endfor
if filereadable(glob('~/.vimrc.plugins')) " Disable plugins by (re)moving ~/.vimrc.plugins
" Download with curl (recommended by vim-plug)
" Use :PlugUpdate to update vim-plug
let vimplug_src = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
let vimplug_dst = expand(root, 1).'/autoload/plug.vim'
let download_error = 0
if !filereadable(vimplug_dst)
if executable('curl') == 1
execute 'silent !curl -l -o '.shellescape(vimplug_dst).' '.vimplug_src
else " assume wget is available
execute 'silent !wget -O '.shellescape(vimplug_dst).' '.vimplug_src
endif
let download_error = v:shell_error
endif
if download_error
echohl ErrorMsg
echomsg 'Unable to download vim-plug. Not installing plugins.'
echohl NONE
else
autocmd VimEnter *
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | q | doautocmd WinEnter
\| endif
call plug#begin(expand(root.'/bundle/'))
source ~/.vimrc.plugins
call plug#end()
endif
endif
General-purpose plugins
These are all plugins I find useful, which I use in all my vim configurations.
Plug 'tpope/vim-eunuch' " File operations
Plug 'tpope/vim-unimpaired' " Useful mappings
Plug 'tpope/vim-surround' " Change surroundings
Plug 'tpope/vim-repeat' " Enable repeating supported plugin maps with '.'
Plug 'tpope/vim-commentary' " Toggle comments: line=gcc, block=gcip, visual=gc
Plug 'tpope/vim-characterize' " Enhance ga with unicode character names
Plug 'tpope/vim-rsi' " Readline-style input makes ctrl-a and ctrl-e work
Plug 'romainl/vim-qlist' " Display results of [I in quickfix window
Plug 'flazz/vim-colorschemes', {'do': ':colorscheme badwolf'}
Plug 'terryma/vim-multiple-cursors' " Sublime Text-like multiple selection. next=^n, prev=^p, skip=^x
Plug 'terryma/vim-expand-region' " IntelliJ-like context-aware selection. expand=+, contract=_
"Plug 'editorconfig/editorconfig-vim' " Universal editor config files - TODO prevent trimming trailing whitespace on save when in git add -p
Plug 'vim-scripts/PreserveNoEOL'
Plug 'vim-scripts/selection_eval.vim' " Evaluate selection with <c-e><c-s>
Plug 'mbbill/undotree' " Browse through undo history
Plug 'd10n/vim-toggle-help' " Toggle help off and on with <F1>
Plug 'bkad/CamelCaseMotion' " Shift+(w|b|e) through camelCase words
Specific-purpose plugins
These are plugins I find useful, but which I only enable selectively. I plan on using coc.vim in the future which may make some of these obsolete.
Plug 'vimwiki/vimwiki' " Personal wiki
Plug 'tpope/vim-scriptease' " Open help for vimscript word under cursor with K
Plug 'tpope/vim-fugitive' " Git commands
Plug 'sheerun/vim-polyglot' " Language pack
Plug 'Chiel92/vim-autoformat' " Integrate external file formatters
" Plug 'scrooloose/syntastic' " Integrate external linters / syntax checkers
Plug 'vim-airline/vim-airline' " Fancy status line
Plug 'vim-airline/vim-airline-themes' " Fancy status line themes
Plug 'easymotion/vim-easymotion' " Jump to any character on screen with \\s
"Plug 'ludovicchabant/vim-gutentags' " Automatically generate tags
Plug 'majutsushi/tagbar' " Show file structure/tags
Plug 'junegunn/goyo.vim' " Distraction-free writing with :Goyo
Plug 'lucc/vim-tip' " Tip of the day
"Plug 'vim-scripts/YankRing.vim'
Plug 'jceb/vim-orgmode' " emacs orgmode for vim
Plug 'vim-scripts/utl.vim' " Universal Text Linking - dependency of vim-orgmode
Plug 'tpope/vim-speeddating' " Increment dates - dependency of vim-orgmode
Plug 'inkarkat/vim-SyntaxRange' " Support syntax regions - dependency of vim-orgmode
Plug 'airblade/vim-gitgutter' " Version control gutter info
" Fuzzy searching
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' } | Plug 'junegunn/fzf.vim'
" File manager
" Pick one:
Plug 'scrooloose/nerdtree' " - to open and close, q to close
"Plug 'justinmk/vim-dirvish' " - to open, q to close *
"Plug 'jeetsukumaran/vim-filebeagle' " - to open, q to close
"Plug 'Shougo/vimproc.vim', {'do' : 'make'} | Plug 'Shougo/unite.vim' | Plug 'Shougo/vimfiler.vim' " - to open and close
"Plug 'tpope/vim-vinegar' " - to open, q to close
if has_key(g:plugs, 'nerdtree')
Plug 'Xuyuanp/nerdtree-git-plugin'
endif