I have a couple of autocmds in my vim config along the lines of this (the actual commands are quite long):
au BufWritePost *.latex.md silent! ...
au BufWritePost *.md silent! ...
where writing files with .md or .latex.md extensions runs pandoc to convert my markdown files into the corresponding format. The problem I have (which you have probably guessed by looking at the example above) is that globbing for *.md subsumes files with a .latex.md extension. This means that files with that extension produce both HTML and a PDF, which is unnecessary. Is there any way to make the two autocommands mutually exlusive, or do I need to create a command or function that runs the correct command instead?
[^x]. And you can't make "not" from "and" and "or" - the Boolean algebra for freshmen. – Matt Dec 13 '19 at 17:41It is possible to use |pattern| items, but they may not work as expected, because of the translation done for the above.So for example, you could try:au BufWritePost *\(.latex\)\@<!.md ...– user938271 Dec 14 '19 at 08:33/tmp/foo.latex.md, only the first autocmd is triggered. And for the file/tmp/foo.bar.md, only the second autocmd is triggered. Then again, maybe I misunderstood something. As for the issue about the translation, I don't think\(.latex\)\@<!is affected. The only character which should be translated is the dot, which in a usual regex stands for any character except the newline, while here it stands for a literal dot. But it's true that in general you have to be careful about which characters you use. – user938271 Dec 14 '19 at 10:01\(...\)based on what I read. But maybe even that was unnecessary. I'll have to look closer. Regardless, you saved my bacon. Thanks again. – B Layer Dec 14 '19 at 10:09