wuruxu

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

  •  
  •   wuruxu · Sep 27, 2025 · 896 views
    This topic created in 271 days ago, the information mentioned may be changed or developed.
    :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 中就可以了
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   913 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 20:14 · PVG 04:14 · LAX 13:14 · JFK 16:14
    ♥ Do have faith in what you're doing.