Tricks Of The Trades

Vim Plugins and Pathogen (The Complete Guide)

Pinterest LinkedIn Tumblr

Vim does a lot with its base install and provides everything you’d expect from a CLI text editor, but to unlock even further awesomeness one needs to delve into the vast libraries of plugins on offer.

One such site that aims to index these plugins is:

Which is awesome in its own right.

To install said plugins there are several varying install solutions on offer (Vundle, NeoBundle, VimPlug, Pathogen, etc). In this post I’ll follow the most basic method of using Pathogen to install Vim plugins, whilst highlighting and describing a list of my own thus far installed and used plugins.

1 – Install Pathogen

Start by making the two configuration directories in your user’s home directory, here’s how to do this:

  1. $ mkdir -p ~/.vim/autoload ~/.vim/bundle && \

Now in the prompt that’s initiated from the last command retrieve the contents of the two new folders with Curl:

  1. > curl -LSso ~/.vim/autoload/pathogen.vim

Install Curl first if you don’t have it install it on Debian/Ubuntu with:

  1. $ sudo apt-get install curl

Or on Arch Linux with:

  1. $ sudo pacman -S curl

Check out Pathogen plugin manager on Github.

2 – Edit .vimrc

After returning to the command line continue by opening your ~/.vimrc file for writing:

  1. $ vim ~/.vimrc

Then add these two lines to run Pathogen and enable plugins:


  1. execute pathogen#infect()
  2. filetype plugin indent on

Save and quit.

3 – Install Plugins

Any plugins I use I’ll add details about here in this section.


To install vim-markdown use these two commands on your system (with Git installed):

  1. $ cd ~/.vim/bundle && \
  2. > git clone git://

To disable the “folding” in markdown files provided by vim-markdown add this line to your ~/.vimrc config file:


  1. let g:vim_markdown_folding_disabled=1


:Toc create a quickfix vertical window navigable table of contents with the headers.

:Toch Same as :Toc but in an horizontal window.

:Toct Same as :Toc but in a new tab.

:Tocv: Same as :Toc for symmetry with :Toch and :Tocv


SuperTab is an auto-completion plugin that allows extra insert mode completion using the key.

After typing a few letters of a word that exists within the current open buffer (vim session) SuperTab will list the auto-completion options it.

  1. $ git clone ~/.vim/bundle/supertab


NERD tree allows you to explore your filesystem in order to easily open files and directories. It takes the form of a tree which you manipulate with the keyboard and/or mouse. It also supports basic filesystem operations.

  1. $ git clone ~/.vim/bundle/supertab

Include this next line in your ~/.vimrc to stop garbled characters and broken directory traversing in your NERDTree.:


  1. let NERDTreeDirArrows = 0

Running NERD Tree

To start a tree in the currently opened file’s directory type this into Vim:

  1. :NERDTree

To do the same but commence the tree in a separate directory, specify the directory path like this:

  1. :NERDTree /etc/X11/Xresources/

To close the tree in the current tab use:

  1. :NERDTreeClose

To quickly find the current file in the tree:

  1. :NERDTreeFind


When the NERD Tree window/tab is active you can type the next command in the current buffer, to bookmark a file or directory that is currently highlighted by the tree.

  1. :Bookmark bookmark_name

Opening bookmark is done with:

  1. :OpenBookmark bookmark_name

If you need to remove a bookmark then use

  1. :ClearBookmarks bookmark_name bookmark_name bookmark_name

Note: If no bookmark names are passed then this will remove all bookmarks on the current node.

Any previous bookmarks made with NERDTree can be used to start the tree by providing the bookmark name. The second command in this next example provides auto-completion when typing out the bookmark name, both commands have the same result, however:

  1. :NERDTree bookmark_name
  2. :NERDTreeFromBookmark bookmark_name

NERD tree Mappings

  1. —————————————————————————–
  2. 2.3. NERD tree Mappings *NERDTreeMappings*
  3. Default Description~ help-tag~
  4. Key~
  5. o…….Open files, directories and bookmarks………………..|NERDTree-o|
  6. go……Open selected file, but leave cursor in the NERDTree…..|NERDTree-go|
  7. t…….Open selected node/bookmark in a new tab……………..|NERDTree-t|
  8. T…….Same as ‘t’ but keep the focus on the current tab……..|NERDTree-T|
  9. i…….Open selected file in a split window…………………|NERDTree-i|
  10. gi……Same as i, but leave the cursor on the NERDTree……….|NERDTree-gi|
  11. s…….Open selected file in a new vsplit…………………..|NERDTree-s|
  12. gs……Same as s, but leave the cursor on the NERDTree……….|NERDTree-gs|
  13. O…….Recursively open the selected directory………………|NERDTree-O|
  14. x…….Close the current nodes parent………………………|NERDTree-x|
  15. X…….Recursively close all children of the current node…….|NERDTree-X|
  16. e…….Edit the current dir……………………………….|NERDTree-e|
  17. <CR>……………same as |NERDTree-o|.
  18. double-click…….same as the |NERDTree-o| map.
  19. middle-click…….same as |NERDTree-i| for files, same as
  20. |NERDTree-e| for dirs. 
  21. D…….Delete the current bookmark ………………………..|NERDTree-D|
  22. P…….Jump to the root node………………………………|NERDTree-P|
  23. p…….Jump to current nodes parent………………………..|NERDTree-p|
  24. K…….Jump up inside directories at the current tree depth…..|NERDTree-K|
  25. J…….Jump down inside directories at the current tree depth…|NERDTree-J|
  26. <C-J>…Jump down to the next sibling of the current directory…|NERDTree-C-J|
  27. <C-K>…Jump up to the previous sibling of the current directory.|NERDTree-C-K| 
  28. C…….Change the tree root to the selected dir……………..|NERDTree-C|
  29. u…….Move the tree root up one directory………………….|NERDTree-u|
  30. U…….Same as ‘u’ except the old root node is left open……..|NERDTree-U|
  31. r…….Recursively refresh the current directory…………….|NERDTree-r|
  32. R…….Recursively refresh the current root…………………|NERDTree-R|
  33. m…….Display the NERD tree menu………………………….|NERDTree-m|
  34. cd……Change the CWD to the dir of the selected node………..|NERDTree-cd|
  35. CD……Change tree root to the CWD…………………………|NERDTree-CD| 
  36. I…….Toggle whether hidden files displayed………………..|NERDTree-I|
  37. f…….Toggle whether the file filters are used……………..|NERDTree-f|
  38. F…….Toggle whether files are displayed…………………..|NERDTree-F|
  39. B…….Toggle whether the bookmark table is displayed………..|NERDTree-B| 
  40. q…….Close the NERDTree window…………………………..|NERDTree-q|
  41. A…….Zoom (maximize/minimize) the NERDTree window………….|NERDTree-A|
  42. ?…….Toggle the display of the quick help…………………|NERDTree-?| 
  43. —————————————————————————–

Check out NERDtree plugin on Github.


This is a syntax checking plugin for Vim that runs files through various external syntax checkers to display any resulting errors to the user. This can be done on demand if needed, or automatically as files are saved. If syntax errors are detected, the user is notified and is happy because they didn’t have to compile their code or execute their script to find them!

Here are the languages it has built in support for:

“ActionScript, Ada, API Blueprint, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and iOS property lists, Puppet, Python, R, Racket, Relax NG, reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Sphinx, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, YACC, YAML, z80, Zope Page Templates, and Zsh.”

Install the plugin with Pathogen as usual via:

  1. $ git clone ~/.vim/bundle/syntastic

Include these new lines in your ~/.vimrc to ensure Syntastic works and displays its content properly:


  1. let g:syntastic_always_populate_loc_list = 1
  2. let g:syntastic_auto_loc_list = 1
  3. let g:syntastic_check_on_open = 1
  4. let g:syntastic_check_on_wq = 0
  5. set statusline+=\ %=%#warningmsg#
  6. set statusline+=\ %=%{SyntasticStatuslineFlag()}
  7. set statusline+=\ %=%*

Check out Syntastic Plugin on Github


“Fugitive.vim may very well be the best Git wrapper of all time.”

This plugin adds a whole new set of commands to Vim to make using Git smoother, flexible, more varied, and all from within the Vim session in question.

Install it as usual with:

  1. $ git clone ~/.vim/bundle/vim-fugitive

Note: The percent symbol (%) is short-hand for the path of the current file.

Base Fugitive Commands

Git fugitive.vim Action
:Git add % :Gwrite Stage the current file to the index
:Git checkout % :Gread Revert current file to last checked in version
:Git rm % :Gremove Delete the current file and the corresponding Vim buffer
:Git mv % :Gmove Rename the current file and the corresponding Vim buffer
:Git commit :Gcommit Opens up a split window to enter a commit message and features Vim’s auto-completion functionality (CTRL + N). :wq and ENTER to confirm.
:Git blame % :Gblame Opens a vertically split window containing annotations for each line of the file: the last commit reference, with author and timestamp. When you scroll one, the other window follows.
:Git status :Gstatus Opens a split window with status, that is interact-able. CNTRL+N & CNTRL + P moves between files names listed, pressing - minus whilst untracked files are highlighted will add it to the index, - on the added modified files will remove them from the index. You can highlight multiple files with visual mode. p on a highlighted file opens up the specific file changes. ENTER opens the highlighted file in the window beneath
:Git diff % :Gdiff Shows current individual file’s insertions or removals in comparison to indexed version.

Check out fugitive.vim Plugin on Github


Distraction-free writing tool that sets the writing dimensions suitable for non-technical and non-programming contexts. It also removes any unnecessary interface elements from the Vim UI. Works well with the limelight.vim plugin is shown after this one.


Install it from Github with:

  1. $ git clone ~/.vim/bundle/goyo.vim

Toggle Goyo on:

  1. :Goyo

Toggle Goyo off:

  1. :Goyo!

Toggle Goyo on but with a specific width:


  1. :Goyo 120

Or with a specific height:


  1. :Goyo x30

Both a specific width and height work too:


  1. :Goyo 120×30

Percentages can be passed instead:


  1. :Goyo 120×30%

Defaults can be set in your ~/.vimrc file via:


  1. g:goyo_width (default: 80)
  2. g:goyo_height (default: 85%)
  3. g:goyo_linenr (default: 0)

Check out goyo.vim Plugin on Github


Allows you to focus and highlight blocks of text and content dynamically, useful for writing oriented environments. Works well with the previous Goyo plugin.


Install with Pathogen as normal:

  1. $ git clone ~/.vim/bundle/limelight.vim

Turn Limelight on:

  1. :Limelight

Turn Limelight on at a specific brightness, can use any value between 0.0 ~ 1.0 where the higher the value the brighter/darker it is:

  1. :Limelight0.3

Turn Limelight off:

  1. :Limelight!

Check out limelight.vim Plugin on Github


This plugin provides an awesome start menu that can be seen whenever Vim is called on its own without any arguments or piped text.

Install with Pathogen as normal:

  1. $ git clone ~/.vim/bundle/vim-startify.vim

Run Vim in a terminal to see the plugin:

  1. $ vim

vim startify

Startify Layout

This is the layout of Startify and how it organises its content by default:

Custom header – How about some ASCII art action? Perhaps even dynamically generated?

Default: <empty>

Recently used files from directory – List recently modified files from the current directory recursively. The list can also be filtered.

Default: <enabled>

Recently used files: List recently used files. The list can also be filtered.

Default: <enabled>

Sessions: List all your sessions from a certain directory, when you’ve made them with the in-built session commands.

Default: ~/.vim/session

Bookmarks – Define bookmarks, thus entries for files that will always be listed. Again appears when you define them.

Default: <empty>

Custom footer: Same as the custom header.. but at the bottom.

Default: <empty>

Navigating the menu can be done by using the usual Vim keys j k or just by keying in whatever is written between the square brackets on that line. You can also double-click anywhere on a line to highlight the paths.

Moreover, you can open several files at once if needed.

Whilst the cursor is on an entry hit either:

  • b – Opens in same window,
  • s – Open in a split window.
  • t – Open in a tab.

There is also e for creating an empty buffer (new file), and i for creating an empty buffer and jumping into insert mode straight away, and then q for quitting the menu.

You can always reopen the Stratify screen via :Startify inside a Vim session.

##Startify Sessions
Using :mksession in Vim to save a Session.vim file to the current directory will show the session as an option in the Startify menu. It will be shown at the top of all lists as entry [0] .

The vim-startify inbuilt session commands can also be used to place saved session files in the ~/.vim/sessions/ folder.

These inbuilt session commands are:

  • :SLoad – Load a session.
  • :SSave – Save a session.
  • :Delete – Delete a session.

Startify Custom Header

Add this line to your ~/.vimrc file to generate an ASCII art cow displaying random both serious and humorous quotes in the Stratify page:


  1. let g:startify_custom_header =
  2. \ map(split(system(‘fortune | cowthink ‘), ‘\n’), ‘” “. v:val’) + [”,”]

Note: You must have cowsay and fortune installed for this to work.

Instead hardcoded ASCII art or any other message can be set like so:


  1. let g:startify_custom_header = [
  2. \ ‘ ________ __ __ ‘,
  3. \ ‘ __ /\_____ \/\ \\ \ ‘,
  4. \ ‘ __ __ /\_\ ___ ___ \/___//”/”\ \ \\ \ ‘,
  5. \ ‘ /\ \/\ \\/\ \ /” __` __`\ /” /” \ \ \\ \_ ‘,
  6. \ ‘ \ \ \_/ |\ \ \/\ \/\ \/\ \ /” /”__ \ \__ ,__\’,
  7. \ ‘ \ \___/ \ \_\ \_\ \_\ \_\ /\_/ /\_\ \/_/\_\_/ ‘,
  8. \ ‘ \/__/ \/_/\/_/\/_/\/_/ \// \/_/ \/_/ ‘,
  9. \ ”,
  10. \ ”,
  11. \ ]

Similar to the Header except appears at the bottom of the menu. This example in the next code snippet displays the date and time in the machine’s local format, and the operating system’s name and version number:


  1. let g:startify_custom_footer =
  2. \ [”] + map(split(system(‘date -R’), ‘\n’), ‘” “. v:val’) + [”] + map(split(system(‘lsb_release -a | tail -n 3’), ‘\n’), ‘” “. v:val’) + [”]

Extra Startify Variables

There are more variables that can be defined and are documented in:


Here are two more that set up the hard coded bookmarks, and another that deletes session file buffers:


  1. let g:startify_bookmarks = [ ‘/etc/apache2/apache2.conf’,’~/.vimrc’]        “Hard-coded vim-startify bookmarks.
  2. 20 let g:startify_session_delete_buffers = 1                “Deletes any session file buffers when a session is loaded.

Check out vim-startify Plugin on Github


This strangely named plugin adds some much appreciated Unix command functionality into Vim.

Install it in Pathogen as usual by cloning the repository with:

  1. $ git clone ~/.vim/bundle/vim-eunuch

The features of eunuch-vim include:

  • :Remove – Delete a buffer and the file on disk simultaneously.
  • :Unlink – Like :Remove, but keeps the now empty buffer.
  • :Move – Rename a buffer and the file on disk simultaneously.
  • :Rename – Like :Move, but relative to the current file’s containing directory.
  • :Chmod – Change the permissions of the current file.
  • :Mkdir – Create a directory, defaulting to the parent of the current file.
  • :Find – Run find and load the results into the quickfix list.
  • :Locate – Run locate and load the results into the quickfix list.
  • :Wall – Write every open window. Handy for kicking off tools like guard.
  • :SudoWrite – Write a privileged file with sudo.
  • :SudoEdit – Edit a privileged file with sudo.
  • File type detection for sudo -e is based on original file name.
  • New files created with a shebang line are automatically made executable.
  • New init scripts are automatically pre-populated with the /etc/init.d/skeleton file.

Check out vim-eunuch Plugin on Github


“Wordy is not a grammar checker. Nor is it a guide to proper word usage. Rather, wordy is a lightweight tool to assist you in identifying those words and phrases known for their history of misuse, abuse, and overuse, at least according to usage experts. For example, if wordy highlights moreover in your document, a word for which no good usage exists, you should consider a rewrite to eliminate it. But if wordy highlights therefore in a sentence where you can demonstrate the usage is sound, you can elect to keep it —wordy be damned.”

Still not sure how this works?

See the gif below:


Install it with this line:

  1. $ git clone ~/.vim/bundle/vim-wordy

To disable it and restore your previous Vim environment after using one of the below options, enter the command:

  1. :NoWordy

Use Vim’s Normal mode commands for navigating misspelled words to go to those words flagged by wordy.

  • ]s – Move to next misspelled word after the cursor.
  • [s – Like ]s but search backwards.

Weak & Lazy Usage

  1. :Wordy weak

Redundant & Problematic Usage

  1. :Wordy redundant
  2. :Wordy problematic

Puffery & Jargon

  1. :Wordy puffery
  2. :Wordy business-jargon
  3. :Wordy art-jargon

Manipulative Language

  1. :Wordy weasel

To Be & The Passive Voice

  1. :Wordy being
  2. :Wordy passive-voice

Colloquialisms, Idioms, and Similies

  1. :Wordy colloquial
  2. :Wordy idiomatic
  3. :Wordy similies


  1. :Wordy said-synonyms
  2. :Wordy opinion
  3. :Wordy contractions
  4. :Wordy vague-time

Check out vim-wordy Plugin on Github


This is a plugin for creating and pushing Gists –

gist-vim Setup

Install the plugin by cloning the gist-vim repository:

  1. $ git clone ~/.vim/bundle/gist-vim

Then also install the webapi-vim plugin as gist-vim requires it to authenticate to Github:

  1. $ git clone ~/.vim/bundle/webapi-vim

Now ensure your username is set in Git’s global config file with the next command, where 5car1z is replaced with your own Git username:

  1. $ git config –global github.user 5car1z

Open a blank Vim file and enter the basic command to begin authenticating with Github:

  1. :Gist

Enter your Github account password:

  1. :Gist

  1. Gist.vim requires authorization to use the Github API. These settings are stored in “~/.gist-vim”. If you want to revoke, do “rm ~/.gist-vim”.
  2. Github Password for 5car1z:

Now the token file is created in your user’s home directory you can continue onto using the plugin. If you stop using the plugin, remember to remove this file. Or to revoke the associated Github token, go to the list of “Authorised applications” on Github’s “Account Settings” through their website.

gist-vim Commands

Post the current buffer (file) to Github Gists using the default privacy option:

  1. :Gist

Create a private Gist:

  1. :Gist -p

Create a public Gist – Only relevant if you’ve set Gists to be private by default:

  1. :Gist -P

Create a Gist anonymously:

  1. :Gist -a

Create a Gist with all open buffers:

  1. :Gist -m

Edit the Gist (you need to have opened the gist buffer first). You can update the Gist with the :w command within the Gist buffer:

  1. :Gist -e

Edit the Gist with the name (you need to have opened the Gist buffer first):

  1. :Gist -e

Post/Edit the Gist with an added description (you need to have opened the Gist buffer first):

  1. :Gist -s Add words here for a description of the gist.
  2. :Gist -e -s Add words here for a description of the gist after editing.

Delete the Gist (you need to have opened the Gist buffer first) and password authentication is required:

  1. :Gist -d

Fork the Gist (you need to have opened the Gist buffer first).

Password authentication is required:

  1. :Gist -f

Star the Gist (you need to have opened the Gist buffer first).

Password authentication is required:

  1. :Gist +1

Unstar the Gist (you need to have opened the gist buffer first).

Password authentication is required:

  1. :Gist -1

Get gist example-name from Github:

  1. :Gist example-name

Get gist example-name and add it to the clipboard:

  1. :Gist -c example-name

List your public Gists:

  1. :Gist -l

List Gists from user 5car1z on Github:

  1. :Gist -l 5car1z

List everyone’s Gists:

  1. :Gist -la

List Gists only from your starred Gists:

  1. :Gist -ls

Open the Gist in a web browser after you post or update it.

  1. :Gist -b

gist-vim Variables

To make gist-vim detect filetypes from the filename enable:


  1. let g:gist_detect_filetype = 1

If you want to set it to open your web browser along with a Gist post:


  1. let g:gist_open_browser_after_post = 1

If you want to set or change the browser in question, where firefox is the name of the browser’s command line program:


  1. let g:gist_browser_command = ‘firefox %URL% &’

If you want to show your private Gists as part of the :Gist -l command:


  1. let g:gist_show_privates = 1

If you want all your Gist posts to be private by default:


  1. let g:gist_post_private = 1

If you want all your Gist posts to be anonymous by default:


  1. let g:gist_post_anonymous = 1

If you want to manipulate multiple files in a gist:


  1. let g:gist_get_multiplefile = 1

If you want to use gist-vim with Github Enterprise instead:


  1. let g:gist_api_url = ‘http://your-github-enterprise-domain/api/v3’

Check out gist.vim Plugin on Github

On top of all this, Nick Nisi has an incredibly popular video dedicated to Vim customisation, and is required watching for anyone new to the art – see below:

Write A Comment