My VIM Configuration


I’m a big fan of the text editor Vim and of Neovim in particular. (I’m told that Emacs is also an amazing editor, too, and I’ve been meaning to use it more.)

But configuring a tool as powerful as vim can look daunting. I hope this breakdown of my personal configuration makes that power more accessible. Let’s begin:

The .vimrc/.config/nvim/init.vim file:

Enable the pathogen plugin manager:

execute pathogen#infect()

Enable syntax highlighting:

syntax on

Various setup steps related to the current file’s apparent filetype:

filetype plugin indent on

Show the number of each line of text in a column on the left side of the window:

set number

Use two spaces as the default indentation in various context:

set expandtab
set tabstop=2
set shiftwidth=2

Highlight all text that matches the current search pattern:

set hlsearch

Ignore alphabetical case when searching text (so /apple would match Apple or APPLE):

set ignorecase

Ignore various files and directory when using the ctrlp plugin for file search, such as some executables, images, audio tracks, source control management files, and other files not intended for editing in vim. (Doing so can reduce the number of files indexed dramatically.)

let g:ctrlp_custom_ignore = {
	\ 'dir':  '\v[\/]\.(git|hg|svn)$',
	\ 'file': '\v\.(exe|so|dll|rpyc|rpyb|png|wav)$',
	\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
	\ }

let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']

I look forward to updating this as a living document as my configuration evolves. I hope you found it useful, too!