From 60dee3ed40b81e9715647739708fa050b0871dcc Mon Sep 17 00:00:00 2001 From: yuki_yano Date: Thu, 20 Feb 2020 16:46:11 +0900 Subject: [PATCH 1/2] Add highlight priority --- README.md | 4 ++++ autoload/ruby_hl_lvar.vim | 2 +- plugin/ruby_hl_lvar.vim | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f6211d9..012c129 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,10 @@ let g:ruby_hl_lvar_hl_group = 'RubyLocalVariable' " Default: 1 let g:ruby_hl_lvar_auto_enable = 0 +" g:ruby_hl_lvar_hl_group highlight priority +" Default: 0 +let g:ruby_hl_lvar_highlight_priority = 0 + " If you wish to control the plugin manually, map these functions. nmap he (ruby_hl_lvar-enable) nmap hd (ruby_hl_lvar-disable) diff --git a/autoload/ruby_hl_lvar.vim b/autoload/ruby_hl_lvar.vim index 2e342f4..08e0247 100644 --- a/autoload/ruby_hl_lvar.vim +++ b/autoload/ruby_hl_lvar.vim @@ -66,7 +66,7 @@ function! s:redraw_window() endif else if get(b:, 'ruby_hl_lvar_match_pattern', '') != '' - let w:ruby_hl_lvar_match_id = matchadd(g:ruby_hl_lvar_hl_group, b:ruby_hl_lvar_match_pattern, 0) + let w:ruby_hl_lvar_match_id = matchadd(g:ruby_hl_lvar_hl_group, b:ruby_hl_lvar_match_pattern, g:ruby_hl_lvar_highlight_priority) endif endif diff --git a/plugin/ruby_hl_lvar.vim b/plugin/ruby_hl_lvar.vim index 8893923..a2a6bc2 100644 --- a/plugin/ruby_hl_lvar.vim +++ b/plugin/ruby_hl_lvar.vim @@ -12,6 +12,9 @@ let g:ruby_hl_lvar_auto_enable = let g:ruby_hl_lvar_show_warnings = \ get(g:, 'ruby_hl_lvar_show_warnings', 0) +let g:ruby_hl_lvar_highlight_priority = + \ get(g:, 'ruby_hl_lvar_highlight_priority', 0) + augroup ruby_hl_lvar autocmd! autocmd Filetype * call Ruby_hl_lvar_filetype() From b18e752b9794ca74b92a2239969ec3ccb8aa48de Mon Sep 17 00:00:00 2001 From: yuki_yano Date: Thu, 20 Feb 2020 17:02:09 +0900 Subject: [PATCH 2/2] Fix highlight_priority add to matchaddpos --- autoload/ruby_hl_lvar.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/ruby_hl_lvar.vim b/autoload/ruby_hl_lvar.vim index 08e0247..647b53d 100644 --- a/autoload/ruby_hl_lvar.vim +++ b/autoload/ruby_hl_lvar.vim @@ -59,7 +59,7 @@ function! s:redraw_window() let i = 0 while i < size let poses = b:ruby_hl_lvar_match_poses[i : i + 7] - let m = matchaddpos(g:ruby_hl_lvar_hl_group, poses, 0) + let m = matchaddpos(g:ruby_hl_lvar_hl_group, poses, g:ruby_hl_lvar_highlight_priority) call add(w:ruby_hl_lvar_match_ids, m) let i += 8 endwhile