Is it possible to use a variable as the subject of an autocmd
?
I want to allow plugin users to define a list of FileTypes
the plugin will operate on.
This requires that I set an autocommand
for each of the given FileTypes
.
The below code doesn't work:
let g:enabledFileTypes = ['javascript', 'vim']
autocmd FileType g:enabledFileTypes * call myFunction()
This does:
autocmd FileType javascript,vim * call myFunction()
Is it possible to declare an autocommand that uses a variable as the file type list?