I'm using the following syntax to match files with *Log
in the file name and force log highlighting syntax (which is available here):
au BufRead,BufNewFile *Log setlocal syntax=log
I would like to expand this expression to capture all possible variations including someNamelog, some_name_LoG, some_session_log_some_date, some_session_log121231 and so on. In practice, I would like to capture all instances of the word log
irrespectively of case. Initially, I've tried using:
au BufRead,BufNewFile *(l|L)og setlocal syntax=log
to capture log
and Log
but this does not work. Is there any way to do it that would not require multiple au BufRead,BufNewFile
calls?
You can use globbing, like in your shell:
autocmd! BufRead,BufNewFile *{log,Log,lOg,loG,LOG}* setlocal syntax=log
(I'll leave the rest of the list up to you)
See :help file-pattern
.