I use gvim to edit my tex files and it is the default editor. So I just double click on the tex files to edit them and that opens them with Gvim. However, the working directory for Gvim is always the home directory which is odd since I would expect the working directory to be the one in which the file that I have just double-clicked and opened is present. This causes a lot of inconvenience since I normally want to run commands in that directory in Gvim and I have to manually change it every time. Any suggestions on how I can have Gvim starting in the proper way? Thanks a lot in adcvance.
I have already checked the .gvimrc
file and I see nothing suspicious. It just has my font and color settings, that's all.
Sorry for resurrecting such an old question, but I found it when I had the same problem, so maybe the solution I finally found can help someone who stumbles upon this like me.
Just add
to your
.vimrc
. That way, (g)vim changes to the directory of the current file at start, which means, unlike withautochdir
, no plugins get broken. Also, you can still edit a file in a subdirectory and still run commands in the working directory.That means, when you have you bibfile in a subdirectory, you could edit it and run
bibtex
while you have that file still open. Withautochdir
you would have to change to a file in the working directory first.Hope that helps someone! :)