You asked for it :-) "{{{Auto Commands " Automatically cd into the directory that the file is in autocmd BufEnter * execute "chdir ".escape(expand("%:p:h"), ' ') " Remove any trailing whitespace that is in the file autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif " Restore cursor position to where it was before augroup JumpCursorOnEdit au! autocmd BufReadPost * \ if expand("<afi