Ilya Hegai wrote:

Hello, I have such line in my .gvimrc

autocmd BufEnter * :lcd %:p:h

(this is vim tip: http://vim.sourceforge.net/tips/tip.php?tip_id=101)

but when I work with remote files via netrw it produces warning every
time, 'cause scp copies remote files to /tmp dir

Is there any way to determine whether file is opening via netrw to
disable that autocmd?


* Check into :set acd , although this may not work if your vim doesn't support it.

* I believe that BufEnter autocmds fire before BufRead and FileRead events,
  so when your autocmd fires, netrw's remote file handling events haven't
fired yet. So you need a smarter event; perhaps something like (untested):

au BufEnter * :if expand("<afile>") !~ '^\a\+://' | :lcd %:p:h | endif

Regards,
Chip Campbell

Reply via email to