-
Notifications
You must be signed in to change notification settings - Fork 65
Description
Use simpler approach suggested by @matveyt vim/vim#16259 (comment)
All one has to do is to trap
BufNew
and if it'sisdirectory()
then set upBufReadCmd
for this particular buffer. No need to add any extra autocommands.If anyone is interested the code example is here.
caveat?:
No
VimEnter
. It is enough to iterate through all pre-loaded buffers once on plugin startup.
I've no idea why everyone likes to polluteBufEnter
. In my implementation I go without it.
P.S. The only problem I'm aware of that might force usage ofBufEnter
or similar is that some window-local options might not be synchronized properly. Suppose you have one directory buffer opened in several different windows. Then&concealcursor
or such may be not set in some of them. This is unfortunate but kind of expected, as long as we're doing only "per buffer init" and never "per window init". Personally, I opted just to ignore that small issue.