Bram Moolenaar wrote the following on 16.02.2011 20:07
Hello Mathieu and Bram
> Mathieu Parent wrote:
>
>> I'm posting the message below again, as I had no response.
>>
>> (and http://code.google.com/p/vim/source/browse/runtime/filetype.vim
>> is still not patched).
>
> It might help to list the pattern here directly:
>
> au BufNewFile,BufRead
> /var/log/{auth.log,cron.log,daemon.log,debug,kern.log,lpr.log,mail.err,mail.info,mail.log,mail.warn,messages,news/news.crit,news/news.err,news/news.notice,syslog,user.log}{,.*[0-9]}
> setf messages
>
> It's a long list, but there probably is no other way.
Thanks Mathieu for the idea to look at that.
I habe since what i think improved the patch as follows:
autocmd BufNewFile,BufRead
\ */log/
\{
\auth,
\cron,
\daemon,
\debug,
\kern,
\lpr,
\mail,
\messages,
\news/news,
\syslog,
\user
\}
\{,.log,.err,.info,.warn,.crit,.notice}{,.*[0-9]*}
\ setf filetype=messages
1. */log instead of /var/log
This makes the filedetection more useful when the logfile to read is
elsewhere e.g. in case of backups or from a LiveCD.
2. auth,{,.log} instead of auth.log
iirc some distributions used to have a different naming conventions.
3. {,.*[0-9]*} instead of {,.*[0-9]}
When i am not mistaken the logfiles are named foo.1 and foo.3.gz after
logrotate did it's job. So i assume the latter doesn´t catch that, but i
haven´t tested that.
Find the one line version for your convenience attached.
--
bye Thilo
4096R/0xC70B1A8F
721B 1BA0 095C 1ABA 3FC6 7C18 89A4 A2A0 C70B 1A8F
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
autocmd BufNewFile,BufRead
*/log/{auth,cron,daemon,debug,kern,lpr,mail,messages,news/news,syslog,user}{,.log,.err,.info,.warn,.crit,.notice}{,.*[0-9]*}
setf filetype=messages