Hello,vim users! If you’re like me, you’re always looking for new ways to improve your productivity and efficiency. Vim is a great tool for this purpose, but it can be a little overwhelming to learn all of its features. That’s why I’ve created this guide, which will teach you the basics of vim plugins and pathogen. First, let’s take a look at what vim plugins are: they are files that add functionality to your vim editor. There are many different types of vim plugins, but the most popular ones are those that add features to the editor itself (like syntax highlighting or code completion). Next, let’s take a look at how pathogen works: it is a tool that helps you create custom infections for your computer. This means that instead of using the built-in Vim commands to install and configure plugins and pathogens, you can use pathogen to do this automatically. This makes it much easier to get started with vim and pathogen! Finally, let’s take a look at some tips on how to usevim and pathogen together best: these tips will help make your work in vim more efficient and productive.


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 – Install Pathogen2 – Edit . vimrc3 – Install PluginsSuperTabNERD TreeBookmarksNERD tree MappingsSyntasticfugitive. vimgoyo. vimlimelight. vimvim-startifyStartify LayoutNavigating StartifyExtra Startify Variableseunuch-vimvim-wordygist-vim

[alert-announce]

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

[/alert-announce]

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

[alert-announce]

curl -LSso ~/. vim/autoload/pathogen. vim https://tpo. pe/pathogen. vim

[/alert-announce]

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

[alert-announce]

$ sudo apt-get install curl

[/alert-announce]

Or on Arch Linux with:

[alert-announce]

$ sudo pacman -S curl

[/alert-announce]

Check out Pathogen plugin manager on Github.

2 – Edit .vimrc

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

[alert-announce]

$ vim ~/. vimrc

[/alert-announce]

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

[alert-announce]

~/.vimrc

execute pathogen#infect() filetype plugin indent on

[/alert-announce]

Save and quit.

3 – Install Plugins

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

vim-markdown

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

[alert-announce]

$ cd ~/. vim/bundle && \ > git clone git://github. com/plasticboy/vim-markdown. git

[/alert-announce]

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

[alert-announce]

~/.vimrc

let g:vim_markdown_folding_disabled=1

[/alert-announce]

Commands

: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

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.

[alert-announce]

$ git clone https://github. com/ervandew/supertab. git ~/. vim/bundle/supertab

[/alert-announce]

NERD Tree

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.

[alert-announce]

$ git clone https://github. com/scrooloose/nerdtree ~/. vim/bundle/supertab

[/alert-announce]

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

[alert-announce]

~/.vimrc

let NERDTreeDirArrows = 0

[/alert-announce]

Running NERD Tree

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

[alert-announce]

:NERDTree

[/alert-announce]

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

[alert-announce]

:NERDTree /etc/X11/Xresources/

[/alert-announce]

To close the tree in the current tab use:

[alert-announce]

:NERDTreeClose

[/alert-announce]

To quickly find the current file in the tree:

[alert-announce]

:NERDTreeFind

[/alert-announce]

Bookmarks

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.

[alert-announce]

:Bookmark bookmark_name

[/alert-announce]

Opening bookmark is done with:

[alert-announce]

:OpenBookmark bookmark_name

[/alert-announce]

If you need to remove a bookmark then use

[alert-announce]

:ClearBookmarks bookmark_name bookmark_name bookmark_name

[/alert-announce]

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:

[alert-announce]

:NERDTree bookmark_name :NERDTreeFromBookmark bookmark_name

[/alert-announce]

NERD tree Mappings

[alert-announce]

—————————————————————————– 2. 3. NERD tree Mappings NERDTreeMappings Default Description~ help-tag~ Key~ o……. Open files, directories and bookmarks………………. . |NERDTree-o| go……Open selected file, but leave cursor in the NERDTree…. . |NERDTree-go| t……. Open selected node/bookmark in a new tab……………. . |NERDTree-t| T……. Same as ‘t’ but keep the focus on the current tab……. . |NERDTree-T| i……. Open selected file in a split window…………………|NERDTree-i| gi……Same as i, but leave the cursor on the NERDTree………. |NERDTree-gi| s……. Open selected file in a new vsplit…………………. . |NERDTree-s| gs……Same as s, but leave the cursor on the NERDTree………. |NERDTree-gs| O……. Recursively open the selected directory………………|NERDTree-O| x……. Close the current nodes parent………………………|NERDTree-x| X……. Recursively close all children of the current node……. |NERDTree-X| e……. Edit the current dir………………………………. |NERDTree-e| ……………same as |NERDTree-o|. double-click……. same as the |NERDTree-o| map. middle-click……. same as |NERDTree-i| for files, same as |NERDTree-e| for dirs.   D……. Delete the current bookmark ………………………. . |NERDTree-D| P……. Jump to the root node………………………………|NERDTree-P| p……. Jump to current nodes parent………………………. . |NERDTree-p| K……. Jump up inside directories at the current tree depth…. . |NERDTree-K| J……. Jump down inside directories at the current tree depth…|NERDTree-J| …Jump down to the next sibling of the current directory…|NERDTree-C-J| …Jump up to the previous sibling of the current directory. |NERDTree-C-K|  C……. Change the tree root to the selected dir……………. . |NERDTree-C| u……. Move the tree root up one directory…………………. |NERDTree-u| U……. Same as ‘u’ except the old root node is left open……. . |NERDTree-U| r……. Recursively refresh the current directory……………. |NERDTree-r| R……. Recursively refresh the current root…………………|NERDTree-R| m……. Display the NERD tree menu…………………………. |NERDTree-m| cd……Change the CWD to the dir of the selected node………. . |NERDTree-cd| CD……Change tree root to the CWD…………………………|NERDTree-CD|  I……. Toggle whether hidden files displayed………………. . |NERDTree-I| f……. Toggle whether the file filters are used……………. . |NERDTree-f| F……. Toggle whether files are displayed…………………. . |NERDTree-F| B……. Toggle whether the bookmark table is displayed………. . |NERDTree-B|  q……. Close the NERDTree window…………………………. . |NERDTree-q| A……. Zoom (maximize/minimize) the NERDTree window…………. |NERDTree-A| ?……. Toggle the display of the quick help…………………|NERDTree-?|  —————————————————————————–

[/alert-announce]

Check out NERDtree plugin on Github.

Syntastic

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:

[alert-announce]

$ git clone https://github. com/scrooloose/syntastic. git ~/. vim/bundle/syntastic

[/alert-announce]

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

[alert-announce]

~/.vimrc

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 set statusline+=\ %=%#warningmsg# set statusline+=\ %=%{SyntasticStatuslineFlag()} set statusline+=\ %=%*

[/alert-announce]

Check out Syntastic Plugin on Github

fugitive.vim

“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:

[alert-announce]

$ git clone https://github. com/tpope/vim-fugitive. git ~/. vim/bundle/vim-fugitive

[/alert-announce]

Base Fugitive Commands

Check out fugitive.vim Plugin on Github

goyo.vim

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:

[alert-announce]

$ git clone https://github. com/junegunn/goyo. vim. git ~/. vim/bundle/goyo. vim

[/alert-announce]

Toggle Goyo on:

[alert-announce]

:Goyo

[/alert-announce]

Toggle Goyo off:

[alert-announce]

:Goyo!

[/alert-announce]

Toggle Goyo on but with a specific width:

[alert-announce]

width

:Goyo 120

[/alert-announce]

Or with a specific height:

[alert-announce]

height

:Goyo x30

[/alert-announce]

Both a specific width and height work too:

[alert-announce]

both

:Goyo 120×30

[/alert-announce]

Percentages can be passed instead:

[alert-announce]

percentage

:Goyo 120×30%

[/alert-announce]

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

[alert-announce]

~/.vimrc

g:goyo_width (default: 80) g:goyo_height (default: 85%) g:goyo_linenr (default: 0)

[/alert-announce]

Check out goyo.vim Plugin on Github

limelight.vim

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:

[alert-announce]

$ git clone https://github. com/junegunn/limelight. vim. git ~/. vim/bundle/limelight. vim

[/alert-announce]

Turn Limelight on:

[alert-announce]

:Limelight

[/alert-announce]

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:

[alert-announce]

:Limelight0. 3

[/alert-announce]

Turn Limelight off:

[alert-announce]

:Limelight!

[/alert-announce]

Check out limelight.vim Plugin on Github

vim-startify

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:

[alert-announce]

$ git clone https://github. com/mhinz/vim-startify. git ~/. vim/bundle/vim-startify. vim

[/alert-announce]

Run Vim in a terminal to see the plugin:

[alert-announce]

$ vim

[/alert-announce]

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: 

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

Default: 

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

Default: 

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: 

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

Default: 

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:

[alert-announce]

~/.vimrc

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

[/alert-announce]

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

[alert-announce]

~/.vimrc

let g:startify_custom_header = [ \ ‘ ________ __ __ ‘, \ ‘ __ /_____ /\ \ \ ‘, \ ‘ __ __ /_\ ___ ___ ///”/”\ \ \ \ ‘, \ ‘ /\ /\ \/\ \ /” __\ /” /” \ \ \ _ ‘, \ ‘ \ \ _/ |\ \ /\ /\ /\ \ /” /” \ _ ,\’, \ ‘ \ _/ \ _\ _\ _\ _\ /_/ /_\ /_/__/ ‘, \ ‘ // //////// // // // ‘, \ ”, \ ”, \ ]

[/alert-announce]

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:

[alert-announce]

~/.vimrc

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

[/alert-announce]

Extra Startify Variables

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

~/.vim/bundle/vim-startify/doc/startify.txt

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

[alert-announce]

~/.vimrc

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

[/alert-announce]

Check out vim-startify Plugin on Github

eunuch-vim

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

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

[alert-announce]

$ git clone https://github. com/tpope/vim-eunuch. git ~/. vim/bundle/vim-eunuch

[/alert-announce]

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

vim-wordy

Still not sure how this works?

See the gif below:

Install it with this line:

[alert-announce]

$ git clone https://github. com/reedes/vim-wordy. git ~/. vim/bundle/vim-wordy

[/alert-announce]

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

[alert-announce]

:NoWordy

[/alert-announce]

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

[alert-announce]

:Wordy weak

[/alert-announce]

Redundant & Problematic Usage

[alert-announce]

:Wordy redundant :Wordy problematic

[/alert-announce]

Puffery & Jargon

[alert-announce]

:Wordy puffery :Wordy business-jargon :Wordy art-jargon

[/alert-announce]

Manipulative Language

[alert-announce]

:Wordy weasel

[/alert-announce]

To Be & The Passive Voice

[alert-announce]

:Wordy being :Wordy passive-voice

[/alert-announce]

Colloquialisms, Idioms, and Similies

[alert-announce]

:Wordy colloquial :Wordy idiomatic :Wordy similies

[/alert-announce]

Miscellaneous

[alert-announce]

:Wordy said-synonyms :Wordy opinion :Wordy contractions :Wordy vague-time

[/alert-announce]

Check out vim-wordy Plugin on Github

gist-vim

This is a plugin for creating and pushing Gists – http://gist.github.com

gist-vim Setup

Install the plugin by cloning the gist-vim repository:

[alert-announce]

$ git clone https://github. com/mattn/gist-vim. git ~/. vim/bundle/gist-vim

[/alert-announce]

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

[alert-announce]

$ git clone https://github. com/mattn/webapi-vim. git ~/. vim/bundle/webapi-vim

[/alert-announce]

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:

[alert-announce]

$ git config –global github. user 5car1z

[/alert-announce]

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

[alert-announce]

:Gist

[/alert-announce]

Enter your Github account password:

[alert-announce]

:Gist

[/alert-announce]

[alert-announce]

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”. Github Password for 5car1z:

[/alert-announce]

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:

[alert-announce]

:Gist

[/alert-announce]

Create a private Gist:

[alert-announce]

:Gist -p

[/alert-announce]

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

[alert-announce]

:Gist -P

[/alert-announce]

Create a Gist anonymously:

[alert-announce]

:Gist -a

[/alert-announce]

Create a Gist with all open buffers:

[alert-announce]

:Gist -m

[/alert-announce]

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:

[alert-announce]

:Gist -e

[/alert-announce]

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

[alert-announce]

:Gist -e example. sh

[/alert-announce]

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

[alert-announce]

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

[/alert-announce]

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

[alert-announce]

:Gist -d

[/alert-announce]

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

Password authentication is required:

[alert-announce]

:Gist -f

[/alert-announce]

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

Password authentication is required:

[alert-announce]

:Gist +1

[/alert-announce]

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

Password authentication is required:

[alert-announce]

:Gist -1

[/alert-announce]

Get gist example-name from Github:

[alert-announce]

:Gist example-name

[/alert-announce]

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

[alert-announce]

:Gist -c example-name

[/alert-announce]

List your public Gists:

[alert-announce]

:Gist -l

[/alert-announce]

List Gists from user 5car1z on Github:

[alert-announce]

:Gist -l 5car1z

[/alert-announce]

List everyone’s Gists:

[alert-announce]

:Gist -la

[/alert-announce]

List Gists only from your starred Gists:

[alert-announce]

:Gist -ls

[/alert-announce]

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

[alert-announce]

:Gist -b

[/alert-announce]

gist-vim Variables

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

[alert-announce]

~/.vimrc

let g:gist_detect_filetype = 1

[/alert-announce]

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

[alert-announce]

~/.vimrc

let g:gist_open_browser_after_post = 1

[/alert-announce]

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

[alert-announce]

~/.vimrc

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

[/alert-announce]

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

[alert-announce]

~/.vimrc

let g:gist_show_privates = 1

[/alert-announce]

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

[alert-announce]

~/.vimrc

let g:gist_post_private = 1

[/alert-announce]

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

[alert-announce]

~/.vimrc

let g:gist_post_anonymous = 1

[/alert-announce]

If you want to manipulate multiple files in a gist:

[alert-announce]

~/.vimrc

let g:gist_get_multiplefile = 1

[/alert-announce]

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

[alert-announce]

~/.vimrc

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

[/alert-announce]

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: