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

Re: Retrieving file path for current buffer

Expand Messages
  • Piet Delport
    ... It expands CD directly to the current buffer s path, instead of the literal string #:p:h . HTH, -- Piet Delport Today s subliminal thought is:
    Message 1 of 6 , Jul 2, 2003
    • 0 Attachment
      On Wed, 25 Jun 2003 at 09:21:32 -0400, David Fishburn wrote:
      >
      > Piet Delport suggested using the following (which I find very useful):
      >
      > I have this in my _vimrc:
      > cnoreabbrev CD %:p:h
      >
      > Then if I want to reference the path of the current file I am editing I
      > use CD.
      > When I want to change the vim directory to the directory of the file I
      > am in I use:
      > :cd CD

      You might like this version better, which is what i'm using ATM:

      :cnoreabbrev CD <C-R>=expand('%:p:h')<CR>

      It expands "CD" directly to the current buffer's path, instead of the
      literal string "#:p:h".

      HTH,

      --
      Piet Delport
      Today's subliminal thought is:
    Your message has been successfully submitted and would be delivered to recipients shortly.