Noah Spurrier wrote:
How do I configure Gvim so that the current directory
follows the active document?
I know I've seen this somewhere in the Vim docs, but
none of my searches are turning it up now.

When I'm editing a document in Gvim,
I find that Gvim always uses my home directory as the working directory.
If I use ":w newname" to save the current file under a new name
the new file appears in my home directory rather than the
directory of the current file. The same happens if I enter
":split ." to open a new file in my project. I first see my
home directory. I have to browse back to my project directory.
I would like ":split ." to open the same directory as my active document.
I have the same problem with ":make"!

I don't have this problem with vim from the command-line because
I usually start vim from my project directory so the
current working directory is already set.

I'm using Gvim 7.0 under Linux Ubuntu 6.10

Yours,
Noah




- To always change to the directory of the current file

        :set autochdir

I find this very disturbing, though, because after ":split subdir/file" I'll find myself editing "file" with the current dir changed without me having issued any change-dir command. I prefer using ":lcd" explicitly, and not necessarily to the file's dir.

- To change (once) to the dir of the current file

        :cd %:p:h

- To change a single window's local directory to that of its file without touching the other windows

        :lcd %:p:h

Note: The status-line of each window will show you its file path relative to the current working directory. You may want to set

        :set laststatus=2

to always have a status line on all windows.


Best regards,
Tony.
--
Resisting temptation is easier when you think you'll probably get
another chance later on.

Reply via email to