From 3e861d7d2bebd4ef9782cffb86899f62165c8035 Mon Sep 17 00:00:00 2001 From: Sebastian Andersson Date: Sun, 8 Oct 2017 19:19:42 +0200 Subject: [PATCH] Add more configuration options - Option to disable auto highlighting: g:hier_auto_highlight - Option to highlight only the column instead of the whole line: g:hier_highlight_mode, where 1 is the whole line and 2 is column only --- plugin/hier.vim | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/plugin/hier.vim b/plugin/hier.vim index 179731e..f955791 100644 --- a/plugin/hier.vim +++ b/plugin/hier.vim @@ -9,6 +9,10 @@ endif let g:loaded_hier = 1 let g:hier_enabled = ! exists('g:hier_enabled') ? 1 : g:hier_enabled +let g:hier_auto_highlight = ! exists('g:hier_auto_highlight') ? 1 : g:hier_auto_highlight + +" Highlight modes: 1 = Whole line, 2 = Column only +let g:hier_highlight_mode = ! exists('g:hier_highlight_mode') ? 1 : g:hier_highlight_mode let g:hier_highlight_group_qf = ! exists('g:hier_highlight_group_qf') ? 'SpellBad' : g:hier_highlight_group_qf let g:hier_highlight_group_qfw = ! exists('g:hier_highlight_group_qfw') ? 'SpellLocal' : g:hier_highlight_group_qfw @@ -74,7 +78,11 @@ function! s:Hier(clearonly) endif if i.lnum > 0 - call matchadd(hi_group, '\%'.i.lnum.'l') + let pattern = '\%'.i.lnum.'l' + if g:hier_highlight_mode == 2 && i.col > 0 + let pattern .= '\%'.i.col.'c' + endif + call matchadd(hi_group, pattern) elseif i.pattern != '' call matchadd(hi_group, i.pattern) endif @@ -89,7 +97,9 @@ command! -nargs=0 HierClear call s:Hier(1) command! -nargs=0 HierStart let g:hier_enabled = 1 | HierUpdate command! -nargs=0 HierStop let g:hier_enabled = 0 | HierClear -augroup Hier - au! - au QuickFixCmdPost,BufEnter,WinEnter * :HierUpdate -augroup END +if g:hier_auto_highlight + augroup Hier + au! + au QuickFixCmdPost,BufEnter,WinEnter * :HierUpdate + augroup END +endif