V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
wuruxu
V2EX  ›  分享发现

vim 支持多个高亮颜色的配置

  •  
  •   wuruxu · 16 小时 9 分钟前 · 221 次点击
    :H string1 string2 string3
    可以同时查找三个不同字符串,并用不同颜色标注 日志复杂的时候,还是很有用的

    ```
    let g:multi_highlight_groups = ['SpellBad', 'SpellCap', 'CurSearch', 'DiffAdd', 'DiffChange', 'PmenuExtra']

    function! MultiHighlight(...)
    call clearmatches()
    let group_count = len(g:multi_highlight_groups)
    let i = 0
    for pattern in a:000
    let group = g:multi_highlight_groups[i % group_count]
    call matchadd(group, pattern)
    let i += 1
    endfor
    endfunction
    command! -nargs=+ H call MultiHighlight(<f-args>)
    command! HC call clearmatches()

    把上面的内容 添加到 .vimrc 中就可以了
    目前尚无回复
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1066 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 17:51 · PVG 01:51 · LAX 10:51 · JFK 13:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.