Loading ...
Sorry, an error occurred while loading the content.

121278Re: Incorrect working directory in gvim launched from Konqueror

Expand Messages
  • Jürgen Krämer
    Mar 1, 2011
    • 0 Attachment
      Hi,

      Jean Johner wrote:
      >
      > Thank you for your explanations.
      >
      > 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
      > situation.

      sorry, I seem to have misinterpreted you -- I thought you always wanted
      to set the working directory to the directory of the loaded file, even
      when calling Vim from the command line.

      > - 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.

      I don't have a Unix/Linux box here so I can't really say much. Can Vim
      determine whether it was started from Konqueror (or some other GUI file
      manager) or from the command line? In Windows it just *assumes* it was
      started from Explorer when it was passed a full path including a drive
      letter. What's the path to the file inside Vim, is it absolute or
      relative? You can check this with

      :echo expand('%')

      Does it change for files below the user's home directory and for files
      outside (like in /etc)? If it's always absolute you can simulate the
      Windows behaviour of Vim with the following modified version of the
      autocommand:

      au VimEnter * if strpart(expand('%'), 0, 1) == '/' | cd %:h | endif

      Regards,
      Jürgen

      --
      Sometimes I think the surest sign that intelligent life exists elsewhere
      in the universe is that none of it has tried to contact us. (Calvin)

      --
      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
    • Show all 19 messages in this topic