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.
set autochdirto always change the directory to the directory of the currently edited file. But this might break some plugins. – Marco Apr 12 '13 at 20:50autochdirto be switched off, e.g. minitabexpl (if it's not fixed by now). It's not the default since it breaks vi compatibility and it's not always desired. I personally don't use it because when I type:makeI want to runmakein the main directory. Whenautochdiris used, vim changes the directory and vim cannot launchmakeany longer and the build fails. – Marco Apr 12 '13 at 21:25:edit <bibfile>will not work since I am in the home directory and I'll need to change the directory. Usually I maintain many versions of my tex files as the article progresses and often need to copy/paste chunks of text from the older versions etc... all in the same folder. Anyway, thanks again. – ste_kwr Apr 12 '13 at 21:30:Exto open a file explorer in the directory of the current file. Or create a mapping to be able to switch directory without much effort. This is what I use:nnoremap <silent> <leader>p :cd %:p:h<cr>– Marco Apr 12 '13 at 21:35