published on

Recommendations

#vim is a diverse group of 1000+ individuals, but the "old guard" do have some recommendations for how you should and should not use vim.

First and foremost, the #vim community is not anti-plugin. We love them, but we are also a picky bunch. We prefer no plugins if Vim can do it out of the box and furthermore prefer plugins that work with vim features rather than against them. Plugins that have persistent UI elements (sidebars, mock-tabs, etc) are generally frowned apon as they don't scale.

Native Alternatives to Plugins

ack & ag

These plugins do exactly what they say on the tin, make using ag or ack from in Vim easier. But, they can be mostly replaced by simply improving the program :grep uses.

if executable("ag")
    set grepprg=ag\ --nogroup\ --nocolor\ --ignore-case\ --column
    set grepformat=%f:%l:%c:%m,%f:%l:%m
endif

Bonus points for learning to use :ilist and :dlist (or :Ilist and :Dlist if you install qlist).

airline & powerline

These silly statusline plugins take way more effort than they deliver in value, just customize your statusline!

set statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v]
"              | | | | |  |   |      |  |     |    |
"              | | | | |  |   |      |  |     |    +-- current column
"              | | | | |  |   |      |  |     +-- current line
"              | | | | |  |   |      |  +-- current % into file
"              | | | | |  |   |      +-- current syntax
"              | | | | |  |   +-- current fileformat
"              | | | | |  +-- number of lines
"              | | | | +-- preview flag in square brackets
"              | | | +-- help flag in square brackets
"              | | +-- readonly flag in square brackets
"              | +-- rodified flag in square brackets
"              +-- full path to file in the buffer

bufexplorer, ctrl-p, gtfo, minibufexpl, nerdtree & vinegar

So, this all sort of falls under "getting around" or file management. On the file management front: don't. Just don't use Vim for that. On the other side of the fence, getting around -> The Patient Vimmer has a lot of great info on this topic. But basically -- the built in commands for opening files and getting around buffers are terrific. The power of ** (ie: starstar) really comes into play here -- and smart default 'path' like ".,**" or even better, customized to your environment.

  • :argadd / :next :: want to open all the .md files in your projects... :chdir to it, and :argadd **/*.md -- BAM!
  • :edit :: tab completion and wildcard support, yey!
  • :find :: "an often overlooked command fittingly named :find that differs from :edit in one big way: it can be set to visit specific directories."
  • :buf ::

I created a bunch of mappings to help me use the awesome features of Vim below is just a random subset:

nnoremap <leader>a :argadd <c-r>=fnameescape(expand('%:p:h'))<cr>/*<C-d>
nnoremap <leader>b :b <C-d>
nnoremap <leader>e :e **/
nnoremap <leader>g :grep<space>
nnoremap <leader>i :Ilist<space>
nnoremap <leader>j :tjump /
nnoremap <leader>m :make<cr>
nnoremap <leader>s :call StripTrailingWhitespace()<cr>
nnoremap <leader>q :b#<cr>
nnoremap <leader>t :TTags<space>*<space>*<space>.<cr>
  • L-a :: lets me add files with wildcards, like **/*.md for all markdown files, very useful.
  • L-b :: lands me on the buffer prompt and displays all buffers so I can just type a partial to switch to that buffer
  • L-e :: similar to buffers but for opening a single file
  • L-g :: it just drops me to the grep line
  • L-i :: uses the Ilist function from qlist -- makes :ilist go into a quickfix window, awesome
  • L-j :: lands me on a taglist jump command line, for performance reasons I don't do a -- but you totally could
  • L-m :: runs make, simple but very useful once you start setting up proper make configurations for everything
  • L-s :: strips whitespace using my little function (below)
  • L-q :: switches to the last buffer I was editing, I use this all the darn time to (q)uickswitch
  • L-t :: runs :TTags but on the current file, lands me on a prompt to filter the tags

easymotion & sneak

These plugins are great, and we even have sneak in our recommended plugins. That said, before you jump into using them, make sure you know how to use the built in movement commands. ` # $ % ^ * ( ) 0 _ - + w W e E t T I o O { } [[ [] ][ ]] [m [M ]m ]M [( ]) [{ ]} | A f F ge gE gg G g0 gm g^ g$ g_ g, g; gj gk gI h H j k l L ; ' z. z z- zz zt zb b B n N M , / ? - learn to use all of them!

taglist, tagbar

These fall under the persistent UI classification, you should start by using native vim tags features, and if you need more see TTags on our plugins list.

  • :tjump :: jump to a tag, wildcard support and all that.
  • :tselect :: list tags, yada yada

supertab, vimcompletesme & youcompleteme

Before you reach for a tab completion plugin, consider taking a moment to learn about the built in completion. If you find the keybinding unwieldly, make your own! I like these:

inoremap <silent> ,f <C-x><C-f>
inoremap <silent> ,i <C-x><C-i>
inoremap <silent> ,l <C-x><C-l>
inoremap <silent> ,n <C-x><C-n>
inoremap <silent> ,o <C-x><C-o>
inoremap <silent> ,t <C-x><C-]>
inoremap <silent> ,u <C-x><C-u>

NOTE: YouCompleteMe is very complex to setup and maintain, see loathing.

better-whitespace

Rather than using the better-whitespace plugin, consider just adding this to your vimrc and calling it as needed

function! StripTrailingWhitespace()
  if !&binary && &filetype != 'diff'
    normal mz
    normal Hmy
    %s/\s\+$//e
    normal 'yz<CR>
    normal `z
  endif
endfunction

gundo & undotree

Consider using :earlier and :later -- they are awesome and often all the average user needs...

syntastic

Learn to use and love :make and :quickfix.