Friday, January 24, 2014

Vim Indentation Based on File/Folder Name/Regex

I've been working between a couple of projects that have wildly different coding standards. Vim has a flexible way to change settings based on a file path regular expression. Here is an example line where I set my indentation to 3 if the file path matches the given regexes (forgive the sprawl across two visual lines):

autocmd BufNewFile,BufRead */projectfolder/*.cpp,*/projectfolder/*.h setlocal expandtab tabstop=3 shiftwidth=3

No comments:

Post a Comment