You can view my .vimrc file on GitHub. It’s patched together from various sources. Here I’m going to do a line-by-line explanation of why I have written what I have.
I have this so that I can undo as far back as I need to.
Various indentation/tab improvements including autoindentation and tabs expanding to 4 spaces.
If the file I’m editing is modified externally, vim reloads it.
:W does the same as :w but with sudo - useful for when you forget to run vim as sudo.
I can’t stand editing a file without being able to see line numbers and my location on the page.
Highlighting seach results makes searching much better.
Needed for various things.
Enables syntax highlighting.
This is amazing - it allows you to move across windows with ctrl+hjkl rather than ctrl+w hjkl. Saves so much time. It’s from the ultimate vimrc.
Use case insensitive search, except when using capital letters.
Allow backspacing over autoindent, line breaks and start of insert action
This uses the amazing vim-plug to install my plugins. Here I’ll go through them:
This includes many colourschemes. I use molokai.
This amazing plugin lets you easily surround text with quotes, html tags, brackets, etc.
This makes commenting really streamlined.
This adds a very useful tree view to see your files and open new ones without leaving vim.
Adds git support to nerdtree. A must have if you use git and nerdtree.
While we’re talking about git, here’s a plugin that allows you to use git from within vim!
This adds loads of language-specific functionality. Much better than installing all the language-specific plugins seperately.
This plugin gives a great status bar at the bottom with loads of info. On my system I had to fiddle a bit with the symbols to get them to work.
Themes for vim-airline.
This plugin adds autocomplete for loads of languages.
This adds a line along the side showing git additions, deletions or changes.
Okay, now we’re out of the plugins. There’s still some more stuff though.
Other colour schemes are available.
Other airline themes area available.
Creating an array of airline symbols to fill.
Changing the branch symbol to prevent it from being rendered as just a question mark in a box.
That’s my .vimrc. If you have any suggestions or comments, please do send them to me with one of the contact options.