121312Re: Incorrect working directory in gvim launched from Konqueror
- Mar 2, 2011Hi Jean!
On Di, 01 Mär 2011, Jean Johner wrote:
> I can understand your preferences but consider the following facts:
> - launching gvim from the command line in a subdirectory always
> results in the subdirectory to be the working directory.
> I see no reason why double-clicking in Konqueror should behave
> differently. In most situations, people launching gvim in a
> subdirectory want to open other files in the same directory. By the
> way, other people in this thread seem to suffer from the present
> - The behaviour would be consistent with the Windows behaviour
> - The behaviour would be compatible with the behaviour of almost all
> other text editors in KDE (Emacs, XEmacs, Nedit, Kwrite, Kate). An
> exception is Kedit which behaves like gvim.
The behaviour is already built into vim. But currently it only works
when dragging a file onto gvim and holding down the shift key. I don't
know, whether vim can distinguish between being called from a file
manager and from the commandline.
Hm, but wait, you should be able to script something? Using the solution
from Jürgen, that can be slightly improved to the following:
au VimEnter * if empty($TERM) | sil cd %:h | endif
I think, it doesn't even matter, if the filename is given as relative or
absolute path, because even when given just the filename without a path
or no filename at all, ':h' will expand to '.' which is save in that
case. In any case, the check for an empty $TERM variable should prevent
changing the directory, when called from the command line.
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
- << Previous post in topic Next post in topic >>