1
Fork 0

Clearing highlighting and better instantiation

master
Joshua Potter 2016-12-16 08:21:40 -08:00
parent 620101df7e
commit d731dd2d87
2 changed files with 25 additions and 3 deletions

View File

@ -73,6 +73,21 @@ function! highlight#clear_register(reg)
endfunction
" FUNCTION: ClearAllRegisters() {{{1
" ======================================================================
function! highlight#clear_all_registers()
for key in keys(g:highlight_registry)
call highlight#init_register(key, g:highlight_registry[key])
endfor
for key in keys(s:registry)
if !has_key(g:highlight_registry, key)
call highlight#clear_register(key)
endif
endfor
endfunction
" FUNCTION: CountLastSeen() {{{1
" ======================================================================

View File

@ -87,11 +87,18 @@ vmap <silent> * &n<Plug>HRegistry_CountLastSeen
vmap <silent> # &N<Plug>HRegistry_CountLastSeen
" PROCEDURE: Commands {{1
" ======================================================================
function! s:ClearHighlightRegistry()
call highlight#clear_all_registers()
endfunction
command ClearHighlightRegistry :call <SID>ClearHighlightRegistry()
" PROCEDURE: Initialize {{{1
" ======================================================================
for key in keys(g:highlight_registry)
call highlight#init_register(key, g:highlight_registry[key])
endfor
call s:ClearHighlightRegistry()
call highlight#append_to_search(v:register, @/)