Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Can I get gvim to automatically change the (local) working directory to the current file directory when I change tabs. Or at the very least is there a shortcut command for doing that?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Yes, put

set autochdir

in your vimrc.

share|improve this answer
    
"It's only available if Vim was built with netbeans integration or Sun visual workshop integration." stackoverflow.com/questions/1708623/… –  innaM Nov 28 '09 at 12:21
    
Yes. But, if I'm not mistaken that's the default download option from vim.org. –  ldigas Nov 28 '09 at 16:00
add comment

I htink you looking for autochdir. It should be a builtin command in your vim. To have the current working dir always be what ever buffer you're in, add set autochdir to your vimrc. This is automatic, but may break saving & loading sessions. Check this out for more options. An alternative is to add this to your vimrc:

autocmd BufEnter * lcd %:p:h

This question has also appeared on Stack Overflow

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.