Gerald Koenig wrote:
Thanks very much Tony. Yours is a very complete solution and
I'll try to implement it. I need to look up what "au" and ":h"
mean.
Thanks again.
Jerry
":au", as in the other reply, is short for ":autocmd" (see ":help :au").
":h" after a filename means "remove the filename and keep the path" (see
:help filename-modifiers").
There should be no space between Buf and Read in the autocommand-event
name below, I don't know how that space crept in.
Of course, I only gave a few examples. You should be able to implement,
so to say, "variations on the theme", maybe after reading the help
topics mentioned above and a few others like ":help :cd", "help :lcd",
":help BufRead", ":help :silent", etc.
Best regards,
Tony.
On Sun, Aug 13, 2006 at 11:32:00PM +0200, A.J.Mechelynck wrote:
Gerald Koenig wrote:
I think there must be a way to change the destination path for a
write on :w and put it in the _vimrc as a default, but I can't find
it.
Many TIAs,
Jerry
":w" with no filename will always write the file under the same name and
in the same directory as it already was.
To make the editfile's directory active (and it maybe a different one in
each window, if you use split-window mode):
au Buf Read,BufNew,BufNewFile,BufWinEnter * silent lcd <afile>:h
To make your home directory current when starting Vim:
cd ~
To always start on the filesystem's root directory:
if has ("win32") || has("win16") || has("dos16") || has ("dos32")
cd C:\
else
cd /
endif
Best regards,
Tony.