I have an autocmd for TeX and Markdown files to save the file automatically. Nothing unusual:autocmd CursorHold *.tex,*.md wHowever, as custom settings for these files increased, I split them off into ftplugin/tex.vim and ftplugin/markdown.vim: ftplugin/tex.vimautocmd CursorHold *.tex w ftplugin/markdown.vimautocmd CursorHold *.md wNow, these files are sourced only for the appropriate files, so the pattern matching is redundant. Apparently, autocmds can be buffer-local. From :h autocmd-buffer-local:Buffer-local autocommands are attached to a specific buffer.  They are usefulif the buffer does not have a name and when the name does not match a specificpattern.  But it also means they must be explicitly added to each buffer.Instead of a pattern buffer-local autocommands use one of these forms:        <buffer>        current buffer        <buffer=99>     buffer number 99        <buffer=abuf>   using <abuf> (only when executing autocommands)                        <abuf>That seems to be meant for such usage. Now, both ftplugin/tex.vim and ftplugin/markdown.vim can have:autocmd CursorHold <buffer> wI'm not really concerned about the actual extension as long as the filetype is correct, so this saves me from having to worry about *.md and *.markdown and whatever other extensions are valid for Markdown.Is this usage of <buffer> correct? Are there any pitfalls I should be aware of? Will things get messy if I wipe a buffer and open another (hopefully the numbers won't collide, but )?
For an autocmd in a ftplugin, should I use pattern matching or ?
autocmd;filetype