Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <leader>he <Plug>(ruby_hl_lvar-enable)
nmap <leader>hd <Plug>(ruby_hl_lvar-disable)
Expand Down
4 changes: 2 additions & 2 deletions autoload/ruby_hl_lvar.vim
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ 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
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)
Copy link
Collaborator

@pocke pocke Feb 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you replace 0 on L62 with the option?

let m = matchaddpos(g:ruby_hl_lvar_hl_group, poses, 0)

This plugin uses both of matchadd and matchaddpos functions, so we need to update both function callings.

By the way, I guess we can drop to support matchadd function.
matchaddpos is available since Vim 7.4.330 (ref: #9), but we can use Vim 8.1 now.
It is not a too edge API already, so we have no reason to keep compatibility of old Vim 7.4.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed b18e752

endif
endif

Expand Down
3 changes: 3 additions & 0 deletions plugin/ruby_hl_lvar.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down