Search code examples
vimctags

starting gvim from the working directory


Trying to run gvim 7.3 from the working directory (project location) seems impossible-- it defaults to the home directory which breaks my code browsing and pythoncomplete setup.

I've tried three approaches. First, calling gvim from the working directory:

cd /some/dir && gvim

Second, specifying a 'cd' command for gvim to execute

gvim -c 'cd /some/dir'

Third, telling it to open a particular file in that directory

gvim /some/dir/file.txt

In all cases, when i'm in gvim and type ':cd' to see the current directory what I get is my $HOME directory. Vim, on the ether hand, starts up at the working directory.

Does anyone know if there's a way around the problem or the reasoning behind this?


Solution

  • cd behaves differently in Windows and Unix system

    • On non-Unix systems: Print the current directory name.
    • On Unix systems: Change the current directory to the home directory.
    • Use :pwd to print the current directory on all systems.