gvim "open in new window" should change directory to the one of the current file

Posted by Flavius on Stack Overflow See other posts from Stack Overflow or by Flavius
Published on 2010-03-12T13:14:21Z Indexed on 2010/03/12 13:17 UTC
Read the original article Hit count: 285

Filed under:
|
|

Hi

I'm working in gvim with sessions and tabs, and everything works great. However there is something that is bothering me.

Say I have two files open: /A/B/foo.ext and /C/D/E/bar.ext, the latter being opened last. Now say I want to open /A/B/foobar.ext. I have to go through the hassle of navigating upwards to / and from there to /A/B.

I would like to simply change my active tab to /A/B/foo.ext and have gvim automatically change its active directory to /A/B/, so that when I want to open /A/B/foobar.ext with /A/B/foo.ext being active, I'm already in the right CWD.

This would be very time-saving if you work with two different projects at a time and need to switch back and forth between the two.

Is there any such script that does just that?

Thanks.

© Stack Overflow or respective owner

Related posts about gvim

Related posts about vim