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

Re: changing cwd (easy)

Expand Messages
  • Antoine J. Mechelynck
    ... There is, but I m not sure. Maybe :cd %:p:h ? (or :lcd instead of :cd to change dir only for the current window) ... see :help :saveas ... Regards,
    Message 1 of 5 , Nov 1, 2003
    • 0 Attachment
      jonah <jonahgoldstein@...> wrote:
      > Hi,
      >
      > How can you set the current working directory to the directory of the
      > current file?

      There is, but I'm not sure. Maybe ":cd %:p:h"? (or :lcd instead of :cd to
      change dir only for the current window)
      >
      > Also, is there a way to do a "Save as" and start working on the new
      > file in one simple command?
      > That is, say your working on test.txt. I want a shortcut for doing
      > this:
      >
      > > w test2.txt
      > > e test2.txt

      see ":help :saveas"
      >
      > Thanks for any info,
      > jonah

      Regards,
      Tony.
    • Ing. Stanislav Sitar
      ... put this into your .vimrc Change to the directory the file in your current buffer is in autocmd BufEnter * :cd %:p:h I have copied it from somewhere
      Message 2 of 5 , Nov 3, 2003
      • 0 Attachment
        >Hi,
        >
        >How can you set the current working directory to the directory of the current
        >file?
        >
        >Also, is there a way to do a "Save as" and start working on the new file in one
        >simple command?

        put this into your .vimrc

        " Change to the directory the file in your current buffer is in
        autocmd BufEnter * :cd %:p:h

        I have copied it from somewhere quite a long time ago, and I can't
        imagine living without it.

        Enjoy.
        Stano
      Your message has been successfully submitted and would be delivered to recipients shortly.