Last active
August 29, 2015 14:25
-
-
Save geonnave/b4f41916311f656b8b51 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" add this to your .vimrc and have some highlights when viewing log files | |
" originally made for Android logs; just change the regex for other kinds of logs | |
" the negative number (which is the priority arg) prevents these rules to | |
" override the Search Highlight, since it has priority equal to 0 | |
" not extensively tested; may need additional .vimrc settings | |
" (worked with this settings: https://github.com/geonnave/dotfiles/blob/master/.vimrc) | |
" color codes taken from http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim | |
" error lines have red text | |
highlight log_error ctermfg=203 | |
call matchadd('log_error', '\d\+-\d\+ \d\+:\d\+:\d\+.\d\+\s\+\d\+\s\+\d\+ E .*', -1) | |
call matchadd('log_error', '\d\+-\d\+ \d\+:\d\+:\d\+.\d\+ E\/.*', -2) | |
" debug is blue | |
highlight log_debug ctermfg=74 | |
call matchadd('log_debug', '\d\+-\d\+ \d\+:\d\+:\d\+.\d\+\s\+\d\+\s\+\d\+ D .*', -3) | |
call matchadd('log_debug', '\d\+-\d\+ \d\+:\d\+:\d\+.\d\+ D\/.*', -4) | |
" warning is yellow | |
highlight log_warning ctermfg=148 | |
call matchadd('log_warning', '\d\+-\d\+ \d\+:\d\+:\d\+.\d\+\s\+\d\+\s\+\d\+ W .*', -5) | |
call matchadd('log_warning', '\d\+-\d\+ \d\+:\d\+:\d\+.\d\+ W\/.*', -6) | |
" info is green | |
highlight log_info ctermfg=34 | |
call matchadd('log_info', '\d\+-\d\+ \d\+:\d\+:\d\+.\d\+\s\+\d\+\s\+\d\+ I .*', -7) | |
call matchadd('log_info', '\d\+-\d\+ \d\+:\d\+:\d\+.\d\+ I\/.*', -8) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment