Re: Retrieving file path for current buffer
- On Wed, 25 Jun 2003 at 09:21:32 -0400, David Fishburn wrote:
>You might like this version better, which is what i'm using ATM:
> 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
: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".
Today's subliminal thought is: