Friday, June 18, 2010

Re: Always name buffer with respect to cwd, bug?

On 13/04/10 13:28, Aarto Matti wrote:
> Hello,
>
> So I added this into my .vimrc to fix the problem:
> autocmd BufRead * execute ":cd ".getcwd()

This should be a no-operation, unless the current window has a local
directory (set by :lcd) in which case (IIUC) it sets the global working
directory to the current local directory. Not what I would want.

>
> Now, is there an easy trick with files which are higher in filesystem
> hierarchy to name them with '..' instead of full path?
>
> For example:
> :cd /dir1/dir2
> :e ../a.txt
> buffer named as '/dir1/a.txt', wanted '../a.txt'
>
> --
> Aarto

AFAIK, there isn't. The path displayed on the status line is one of:
- down from the current directory
- down from your home directory
- absolute.

Vim doesn't climb the directory tree up to find a common ancestor. (If
you are at /some/very/very/long/long/long/path/ and decide to edit
/another/very/very/long/long/path/foobar.txt, would you want Vim to
display ../../../../../../../another/very/very/long/long/path/foobar.txt
? On Unix, and when on the same partition on Windows, there is always
"some" common ancestor however far.)


Best regards,
Tony.
--
GUEST: He's killed the best man!
SECOND GUEST: (holding a limp WOMAN) He's killed my auntie.
FATHER: No, please! This is supposed to be a happy occasion! Let's
not bicker and argue about who killed who ...
"Monty Python and the Holy Grail" PYTHON (MONTY)
PICTURES LTD

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

No comments: