With vim, how can I use autocmd's for files in subdirectories of a specific path?
Posted
by René Nyffenegger
on Stack Overflow
See other posts from Stack Overflow
or by René Nyffenegger
Published on 2010-03-13T08:49:09Z
Indexed on
2010/03/13
8:55 UTC
Read the original article
Hit count: 179
I am trying to figure out how I can define an autocmd that influences all files under a specific path.
The autocmd I have tried is something like
autocmd BufNewFile,BufRead /specificPath/** imap <buffer> ....
Now, I'd expect this autocmd to be used if I edited, say, /foo/bar/specificPath/baz/something/bla.txt, but not if I edited /foo/bar/here/and/there/moreBla.txt
If I start vim being in a directory 'above' specificPath, this works as I want it. But it doesn't if I am below that directory. Obviously, the autocmd's pattern is matched against the relative file name, not the absolute one.
© Stack Overflow or respective owner