When customizing your .vimrc, I want to share some advice to you.

Only add lines that you understand.

A lot of people like to customize their .vimrc file. There are a lot of posts on the internet about this and most don’t really explain what each line does. I ran into an issue blindly following a blog post. I was having issues with my colors. I Googled for hours trying to find the lines to get my vim colors working, and nothing worked. I finally decided to reset everything and take it step-by-step. This is my only warning to you, even for this post. Be careful.

I’m breaking this down as if you are completely new to vim. If you know how to install a theme, skip to the second section. That’s where I start customizing the .vimrc file.

If you have any suggestions that I should add or change, let me know via social media located in the footer.

Here are the sections that I will be disussing:

Installing Color Themes

If this isn’t your first time installing a vim color theme, skip to the next section Color Theme.

I really like the Bad Wolf color theme, but if you want the light verison it’s called Good Wolf. If you don’t like Bad Wolf, find a theme you like and look for it’s <theme_name>.vim file.

To install the Bad Wolf color theme, download the badwolf.vim file from their GitHub:

# wget https://raw.githubusercontent.com/sjl/badwolf/master/colors/badwolf.vim

If this is your first time installing a color theme for vim, you need to make a color theme directory:

# mkdir ~/.vim
# mkdir ~/.vim/colors/

Move badwolf.vim to the ~/.vim/colors/ folder:

# mv badwolf.vim ~/.vim/colors/

Now, onto the customizations!

Color Theme

I highly recommend adding comments to each line in your .vimrc file. There have been times where I went back to edit it a few months later and completely forgot what a line does.

syntax enable       " enable syntax processing
colorscheme badwolf " sets the color scheme

syntax enable is fairly straightforward. It enables syntax highlighting and processing. colorscheme <theme> sets your color theme as any of the ones inside of your ~/.vim/colors/ folder. You can add multiple themes inside of this folder, but whatever is added to this line is what your current theme is.

Tabs and Spaces

set expandtab       " tabs are spaces
set tabstop=4       " number of visual spaces per tab
retab               " sets existing tabs to spaces

set expandtab inserts space characters whenever the tab key is pressed. This is purely based on preference. I personally like having spaces instead of tabs. set tabstop=4 controls the number of space characters that is inserted when the tab key is pressed. I have it set to insert 4 space characters. retab takes existing tab characters that are not spaces and converts them to space characters.


set number          " show line #'s
set showcmd         " show command in bottom bar
set cursorline      " highlight current line
set lazyredraw      " redraw only when needed
set showmatch       " highlight matching [{()}]
set ruler           " display cursor position
set confirm         " ask if you want to save
set visualbell      " use visual bell when error

set number adds line numbers on the left of your file contents, like a text editor. set showcmd shows partial commands at the bottom of the screen. set cursorline highlights the whole line where your cursor is currently on. set lazyredraw tells vim to not redraw when it doesn’t need to, meaning it will save you computing power. set showmatch highlights matching brackets, parenthesis, etc. set ruler shows your current cursor position at the bottom of the screen. set confirm makes vim more user friendly by not saying ‘oh you forgot to save, sucks’ to asking you if you would like to save the file if you forget to type :wq. set visualbell tells vim to show you when an error happens, instead of bleeping it out of your speakers.

set incsearch       " search as characters are entered
set hlsearch        " highlight matches

set incsearch allows vim to search as characters are entered, instead of it’s default search when the enter key is pressed. set hlsearch highlights the search results.


Vim can be a monster when first getting into it, but I hope I was able to shed some light on it. Again, if you want to send me your suggestions contact me @evan_eboy.