On 2007-01-12, at 03:45, A.J.Mechelynck wrote:
By default, Vim doesn't change directories when you open a file. If
you open Vim from the Dock, without a filename, the current dir is
your home directory. If you later edit one or more files, the
current directory is unchanged. If you want to edit a file which is
not in the current dir, you should specify the path as part of the
argument to the ":edit" command. (You can use command-line
completion repeatedly to complete one subdirectory or file name at
a time.) If you type just ":e filename", then if "filename" doesn't
exist in the current directory, Vim will assume that you want to
create a new file there.
If, instead, you click a file in Finder, the OS sets the current
directory to that file's directory, then invokes Vim.
If Vim is compiled with +netbeans_intg or with +sun_workshop, you
can set 'autochdir'. This will change the current directory
whenever you edit a new file, switch buffers, etc., so the current
directory will follow the current file. Vim will still not "guess"
a directory name (how could it?): ":e filename" with no path, still
means that you want to edit (or create) a file in the current
directory, whatever it is.
Alternately, you can use
:autocmd BufWinEnter * lcd %:p:h
which will set a "local directory" for each buffer. This
alternative only requires +autocmd, which is included in "Normal",
"Big" and "Huge" builds of Vim.
Personally, I've tried it, and I've found that I don't like
directory changes happening, so to speak, "behind my back". I
prefer that directories only be changed when I use ":cd" or ":lcd"
explicitly. (YMMV)
In any case, each window's status line (when present) displays the
path to the file in that window, relative to the current directory
if possible, or otherwise as an absolute path.
See
:help 'autochdir'
:help :autocmd
:help BufWinEnter
:help :cd
:help :lcd
:help 'laststatus'
Best regards,
Tony.
Wow, you guys are always very helpful! Thanks a lot for help. I
personally prefer a directory changes automatically at least right
know, working with one big project in LaTeX2e. Maybe after that I'll
change my mind being enough experienced ;-)
Thanks a lot once again!
stay in touch,
--
Pozdrawiam - Krzysztof Maj
I'm a Mac now, are you PC?
Oh, dear... ;-)