On Fri, Oct 07, 2011 at 06:31:11PM +0200, Daniel Skorka wrote: > Hello there, > > the current /usr/share/applications/gvim.desktop uses > Exec=gvim -f %F > which leaves the working directory set to $HOME.
Actually, it leaves it to whatever the working directory is of the process that launches gvim. > Therefore, commands > like :make will fail if the file being edited is not in $HOME. > This is often confusing, as one tends to forget this behaviour. It's just as confusing as Vim inheriting the working directory from your shell. That's how spawning a child process works. Unless it takes measures to do otherwise, the child process has the same working directory as the parent process. > In > addition, I don't think one would normally want to leave the working dir > set to $HOME. That's completely subjective. I actually do leave Vim in whatever working directory it had for a lot of my work. I only explicitly change the directory if I have a reason to. > I'd like the Exec line to specifically change the working directory, for > example by doing something like > Exec=gvim -f -c"cd $(dirname %F)" %F > What's your opinion? If you want Vim's working directory to be that of the file you're editing (which is just as likely to be wrong as $HOME is in your example), then there's an option for that—'autochdir' (c.f. ":help 'autochdir'"). Thanks for the suggestion, but I'll be leaving it as is. Cheers, -- James GPG Key: 1024D/61326D40 2003-09-02 James Vega <james...@debian.org>
signature.asc
Description: Digital signature