I've set up an autocmd to automatically create directories of the filepath I'm writing to: au BufWritePre,FileWritePre * call <SID>EnsureDir(expand('<afile>:p:h'))
. This prevents creating directories when I discard the buffer.
I'd like to continue to be able to use stdin, provide url filepaths, and read files into buffers from within vim as normal. But how can I use netrw's features yet prevent it's FileExplorer autocmd (on VimEnter
) to act on new/nonexistent, local files? What's a good approach to this?
I hope it's clear what i'm asking. I'm suprised that I could not find a similar question. I read pi_netrw.txt, but could not find a method there. I use neovim version 0.2.2 on linux 4.14.3-1-ARCH.
VimEnter
autocommand pose a problem?-u testrc.vim
, I did not properly check all scriptnames. There's a custom file in/usr/share/..
that has a function which is resolving the autocmd match on BufNewFile I forgot about. I added anisdirectory
check, and now everything is fine.