版本:gvim,版本7.4.52
操作系统:Linux Mint 17
.vimrc(只有2行!):
autocmd BufRead,BufNewFile *.log set syntax=log4j
autocmd BufRead,BufNewFile program_log set syntax=log4j
家中的.vim目录:
-syntax (directory)
--log4j.vim (plugin's file)
结果:我的所有* .log和program_log看起来都是“黑白”。
UPDATE
输出:scriptnames
(对于file.log):
1: /usr/share/vim/vimrc
2: /usr/share/vim/vim74/debian.vim
3: /usr/share/vim/vim74/syntax/syntax.vim
4: /usr/share/vim/vim74/syntax/synload.vim
5: /usr/share/vim/vim74/syntax/syncolor.vim
6: /usr/share/vim/vim74/filetype.vim
7: /usr/share/vim/vim74/menu.vim
8: /usr/share/vim/vim74/autoload/paste.vim
9: ~/.vimrc
10: /usr/share/vim/vim74/plugin/getscriptPlugin.vim
11: /usr/share/vim/vim74/plugin/gzip.vim
12: /usr/share/vim/vim74/plugin/matchparen.vim
13: /usr/share/vim/vim74/plugin/netrwPlugin.vim
14: /usr/share/vim/vim74/plugin/rrhelper.vim
15: /usr/share/vim/vim74/plugin/spellfile.vim
16: /usr/share/vim/vim74/plugin/tarPlugin.vim
17: /usr/share/vim/vim74/plugin/tohtml.vim
18: /usr/share/vim/vim74/plugin/vimballPlugin.vim
19: /usr/share/vim/vim74/plugin/zipPlugin.vim
20: /usr/share/vim/gvimrc
21: /usr/share/vim/vim74/scripts.vim
默认情况下为Colorscheme
来自/usr/share/vim/vim74/syntax
的文件的语法运行良好(java,css,html等)
打开*.log
后,我尝试了以下命令::syntax on
:set filetype=log4j
等,但log4j-plugin忽略了我。
UPDATE2
当app.php,:scriptnames包含:
21: /usr/share/vim/vim74/syntax/php.vim
22: /usr/share/vim/vim74/syntax/html.vim
23: /usr/share/vim/vim74/syntax/javascript.vim
没关系,我看到突出显示,但是当logs.log - 失败..
答案 0 :(得分:2)
尝试使用 log4jhighlighter 安装细节存在于github中。
答案 1 :(得分:1)
此时autocmd BufRead,BufNewFile * .log set syntax = log4j
autocmd BufRead,BufNewFile program_log set syntax = log4j
set syntax
错误,请尝试set filetype=log4j