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

Setting the directory to the current directory...?!? :-)

Expand Messages
  • Stephen Riehm
    Hi ho, now that I ve been blessed with a Mac at work I m beginning to come accross a few things which I never noticed before. For example, I often work on the
    Message 1 of 3 , Feb 17, 2004
    • 0 Attachment
      Hi ho,

      now that I've been blessed with a Mac at work I'm beginning to come
      accross a few things which I never noticed before.

      For example, I often work on the command line, and edit files with the
      magic command: open -a vim <filename>
      This works wonderfully, but vim thinks that the it's current directory
      is /
      To open another file in the same directory I either have to go back to
      the shell window or :cd my way to the directory and then try :n
      <otherfile>.

      Is there a way to get vim to open with the current directory set
      properly?

      Thanks,

      Steve
    • Bill Tschumy
      ... This is what I have in my .vimrc to set the current directory to the that of the current active buffer. au BufEnter * cd %:p:h au BufEnter *.java
      Message 2 of 3 , Feb 17, 2004
      • 0 Attachment
        On Feb 17, 2004, at 3:08 PM, Stephen Riehm wrote:

        > Hi ho,
        >
        > now that I've been blessed with a Mac at work I'm beginning to come
        > accross a few things which I never noticed before.
        >
        > For example, I often work on the command line, and edit files with the
        > magic command: open -a vim <filename>
        > This works wonderfully, but vim thinks that the it's current directory
        > is /
        > To open another file in the same directory I either have to go back to
        > the shell window or :cd my way to the directory and then try :n
        > <otherfile>.
        >
        > Is there a way to get vim to open with the current directory set
        > properly?
        >
        > Thanks,
        >
        > Steve

        This is what I have in my .vimrc to set the current directory to the
        that of the current active buffer.

        au BufEnter * cd %:p:h
        au BufEnter *.java cd %:p:h
        au BufEnter *.[ch] cd %:p:h



        --
        Bill Tschumy
        Otherwise -- Austin, TX
        http://www.otherwise.com
      • Benji Fisher
        ... I do not think there is an easy way to do it with open, but try one of the other methods suggested at http://macvim.swdev.org/OSX/#FAQ I am not at my Mac
        Message 3 of 3 , Feb 17, 2004
        • 0 Attachment
          On Tue, Feb 17, 2004 at 10:08:10PM +0100, Stephen Riehm wrote:
          > Hi ho,
          >
          > now that I've been blessed with a Mac at work I'm beginning to come
          > accross a few things which I never noticed before.
          >
          > For example, I often work on the command line, and edit files with the
          > magic command: open -a vim <filename>
          > This works wonderfully, but vim thinks that the it's current directory
          > is /
          > To open another file in the same directory I either have to go back to
          > the shell window or :cd my way to the directory and then try :n
          > <otherfile>.
          >
          > Is there a way to get vim to open with the current directory set
          > properly?
          >
          > Thanks,
          >
          > Steve

          I do not think there is an easy way to do it with open, but try one
          of the other methods suggested at

          http://macvim.swdev.org/OSX/#FAQ

          I am not at my Mac right now, so I cannot test it, but I think that

          $ /Applications/vim/Vim.app/Contents/MacOS/Vim -g +17 foo.txt &

          will start Vim.app with the pwd set to the current directory.

          HTH --Benji Fisher
        Your message has been successfully submitted and would be delivered to recipients shortly.