Wednesday, March 2, 2011

Re: Incorrect working directory in gvim launched from Konqueror

On Feb 28, 9:34 am, Jean Johner <jean.joh...@cea.fr> wrote:
> Doing the same in KDE 3.5 Konqueror file manager opens file1.f but the
> working directory is always the user's home directory.

I've got KDE 4, but in principle this stuff is controlled by desktop
entry files (.desktop), which are used by gnome too so I don't think
it's different back in 3.5.

My KDE (in the absence of set autochdir and the like) starts gvim in
my $HOME/Documents; I suppose that's from system settings->about me-
>paths.

I suggest you check out

~/.local/share/applications/gvim.desktop

If it's not there, copy it from /usr/share/applications. (I had to
customize mine because KDE didn't not honour my $PATH when running
gvim, and insisted on running /usr/bin/gvim when I wanted /usr/local/
bin/gvim.) Or, use the system settings to edit the gvim action, I
can't remember what it was like for KDE 3.5.

If there's a Path= entry, that will be used, but that's no good.

Changing the exec key to

f=%f;cd ${f%%/*};/usr/local/bin/gvim -f %F

worked, but looks dodgy in that it assumes bash is being used to run
it; the Desktop Entry specification (http://standards.freedesktop.org/
desktop-entry-spec/desktop-entry-spec-latest.html
) doesn't say
anything about that. and I imagine that desktop environments are free
to exec the command directly.

Telling vim to do it seems to me to be supported; it's working for me
with:

/usr/local/bin/gvim -c "%%:h" -f %F

That sets the current directory to the path of the first file. The %
is doubled to escape it from the desktop mechanism.

NGN, you might like to try that too. I think the other editors (kate,
gedit, ...) are doing the equivalent of vim's set autochdir. IMO this
is not a vim issue, it's a desktop entry specification problem, in
that there's no obvious way to specify the path of the invoked file.

Regards, John

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: