I finally managed to solve the problem!

Here's what is needed in the vimrc :

autocmd BufEnter,BufRead,BufNewFile,BufFilePost * \
execute ":lcd " . expand("%:p:h")

Previously, I was using only the 'BufEnter' event, that doesn't work
when changing directories from within netrw. Then Tony suggested using
the BufRead,BufNewFile,BufFilePost events. But this does not work when
initially entering a directory (eg. :e c:\Projects\Test\)

So I added the BufEnter event to the list, and it works in all cases
that I tested!

Just to summarize the couple of bugs that were found:

1) Using 'let g:netrw_keepdir = 0' has NO EFFECT at all
2) Using 'set autochdir' always switches to the parent directory when
browsing a directory.

Thanks everybody!

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to