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:
Now in the prompt that’s initiated from the last command retrieve the contents of the two new folders with Curl:
Install Curl first if you don’t have it install it on Debian/Ubuntu with:
Or on Arch Linux with:
Check out Pathogen plugin manager on Github.
2 – Edit .vimrc
After returning to the command line continue by opening your
~/.vimrc file for writing:
Then add these two lines to run Pathogen and enable plugins:
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):
To disable the “folding” in markdown files provided by
vim-markdown add this line to your
~/.vimrc config file:
: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
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.
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.
Include this next line in your
~/.vimrc to stop garbled characters and broken directory traversing in your NERDTree.:
Running NERD Tree
To start a tree in the currently opened file’s directory type this into Vim:
To do the same but commence the tree in a separate directory, specify the directory path like this:
To close the tree in the current tab use:
To quickly find the current file in the tree:
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.
Opening bookmark is done with:
If you need to remove a bookmark then use
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:
NERD tree Mappings
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:
Install the plugin with Pathogen as usual via:
Include these new lines in your
~/.vimrc to ensure Syntastic works and displays its content properly:
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:
Note: The percent symbol (
%) is short-hand for the path of the current file.
Base Fugitive Commands
|: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 (
|: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.
|: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:
Toggle Goyo on:
Toggle Goyo off:
Toggle Goyo on but with a specific width:
Or with a specific height:
Both a specific width and height work too:
Percentages can be passed instead:
Defaults can be set in your
~/.vimrc file via:
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:
Turn Limelight on:
Turn Limelight on at a specific brightness, can use any value between
1.0 where the higher the value the brighter/darker it is:
Turn Limelight off:
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:
Run Vim in a terminal to see the plugin:
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?
Recently used files from directory – List recently modified files from the current directory recursively. The list can also be filtered.
Recently used files: List recently used files. The list can also be filtered.
Sessions: List all your sessions from a certain directory, when you’ve made them with the in-built session commands.
Bookmarks – Define bookmarks, thus entries for files that will always be listed. Again appears when you define them.
Custom footer: Same as the custom header.. but at the bottom.
Navigating the menu can be done by using the usual Vim keys
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.
: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
The vim-startify inbuilt session commands can also be used to place saved session files in the
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:
Note: You must have
fortuneinstalled for this to work.
Instead hardcoded ASCII art or any other message can be set like so:
Startify Custom Footer
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:
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:
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:
The features of eunuch-vim include:
:Remove– Delete a buffer and the file on disk simultaneously.
:Remove, but keeps the now empty buffer.
:Move– Rename a buffer and the file on disk simultaneously.
: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.
findand load the results into the quickfix list.
locateand 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
:SudoEdit– Edit a privileged file with
- File type detection for
sudo -eis 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
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:
To disable it and restore your previous Vim environment after using one of the below options, enter the command:
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.
]sbut search backwards.
Weak & Lazy Usage
Redundant & Problematic Usage
Puffery & Jargon
To Be & The Passive Voice
Colloquialisms, Idioms, and Similies
Check out vim-wordy Plugin on Github
This is a plugin for creating and pushing Gists – http://gist.github.com
Install the plugin by cloning the gist-vim repository:
Then also install the webapi-vim plugin as gist-vim requires it to authenticate to Github:
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:
Open a blank Vim file and enter the basic command to begin authenticating with Github:
Enter your Github account password:
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.
Post the current buffer (file) to Github Gists using the default privacy option:
Create a private Gist:
Create a public Gist – Only relevant if you’ve set Gists to be private by default:
Create a Gist anonymously:
Create a Gist with all open buffers:
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:
Edit the Gist with the name
example.sh (you need to have opened the Gist buffer first):
Post/Edit the Gist with an added description (you need to have opened the Gist buffer first):
Delete the Gist (you need to have opened the Gist buffer first) and password authentication is required:
Fork the Gist (you need to have opened the Gist buffer first).
Password authentication is required:
Star the Gist (you need to have opened the Gist buffer first).
Password authentication is required:
Unstar the Gist (you need to have opened the gist buffer first).
Password authentication is required:
example-name from Github:
example-name and add it to the clipboard:
List your public Gists:
List Gists from user
5car1z on Github:
List everyone’s Gists:
List Gists only from your starred Gists:
Open the Gist in a web browser after you post or update it.
To make gist-vim detect filetypes from the filename enable:
If you want to set it to open your web browser along with a Gist post:
If you want to set or change the browser in question, where
firefox is the name of the browser’s command line program:
If you want to show your private Gists as part of the
:Gist -l command:
If you want all your Gist posts to be private by default:
If you want all your Gist posts to be anonymous by default:
If you want to manipulate multiple files in a gist:
If you want to use gist-vim with Github Enterprise instead:
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: