On , I learnt ...

How to add project-specific Vim settings

There’s various ways to do this but I quite like using an autocmd based on a buffer’s filepath. For example:

" ~/.vim/vimrc
function ConfigureKrakenCore()
    nnoremap <leader>ct :!ctags --languages=python<cr>
endfunction

autocmd BufRead */kraken-core/* call ConfigureKrakenCore()

In this case, I wanted to customise my ,ct mapping (that runs ctags) to only index Python files as the “kraken-core” project has reams of JavaScript that I don’t want indexing (as it takes ages). This is a preference particular to me so it would be inappropriate to hard-code configuration to the repo (via, say, a .ctags.d/project.ctags file).

Note, we’re calling a function so it’s easier to add new project-specific settings later on.

Another option is to set exrc and use a per-project .vimrc file (kept out of source control). See: