Let's JAM!

Autochange Directory in Vim

I love Vim. With a fiery passion! One thing which has been bothering me lately, however, is having to change directories manually in Vim. I have found a solution which takes care of this. It automatically switches the directory to the current buffer's location. Add this to your ~/.vimrc:

 

" auto-change directory to current buffer

autocmd BufEnter * :cd %:p:h