Last Updated: February 25, 2016
·
681
· aldl

VIM - cd into the directory of current open file

If you use a fuzzy finder plugin with VIM (like ctrlp or command-t), you might want sometime to actually be in the directory of the file your editing. To do this, add this mapping to your config file (.vimrc):

nnoremap <silent> <leader>d :cd %:p:h<cr>