From e8708d3a9608efc9442b95e5e66dbfd5404d8f74 Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Wed, 17 May 2017 00:01:25 -0700 Subject: [PATCH] Removed last pattern seen --- autoload/highlight.vim | 14 +++----------- plugin/hightlight.vim | 8 ++++---- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/autoload/highlight.vim b/autoload/highlight.vim index 67b4e0b..05d3d9b 100644 --- a/autoload/highlight.vim +++ b/autoload/highlight.vim @@ -7,13 +7,6 @@ " SCRIPT VARIABLES: " ====================================================================== -" s:last_pattern_seen :: String {{{2 -" ---------------------------------------------------------------------- -" The pattern last appended to a registry list. - -let s:last_pattern_seen = @/ - - " s:active_register :: String {{{2 " ---------------------------------------------------------------------- " The register currently active. This defaults to the unnamed register. @@ -108,13 +101,13 @@ function! highlight#clear_all_registers() endfunction -" FUNCTION: CountLastSeen() {{{1 +" FUNCTION: CountPattern() {{{1 " ====================================================================== -function! highlight#count_last_pattern_seen() +function! highlight#count_pattern(pattern) if len(@/) > 0 let pos = getpos('.') - exe ' %s/' . s:last_pattern_seen . '//gne' + exe ' %s/' . a:pattern . '//gne' call setpos('.', pos) endif endfunction @@ -144,7 +137,6 @@ endfunction " ====================================================================== function! highlight#append_to_search(reg, pattern) - let s:last_pattern_seen = a:pattern if len(a:pattern) == 0 return endif diff --git a/plugin/hightlight.vim b/plugin/hightlight.vim index 90b96a4..caf55b4 100644 --- a/plugin/hightlight.vim +++ b/plugin/hightlight.vim @@ -37,13 +37,13 @@ endif " Append Searches noremap HRegistry_AppendToSearch \ :call highlight#append_to_search(v:register, '\<'.expand('').'\>') - \ call highlight#count_last_pattern_seen() + \ call highlight#count_pattern('\<'.expand('').'\>') noremap HRegistry_GlobalAppendToSearch \ :call highlight#append_to_search(v:register, expand('')) - \ call highlight#count_last_pattern_seen() + \ call highlight#count_pattern(expand('')) noremap HRegistry_VisualAppendToSearch \ :call highlight#append_to_search(v:register, highlight#get_visual_selection()) - \ call highlight#count_last_pattern_seen() + \ call highlight#count_pattern(highlight#get_visual_selection()) " Remove Searches noremap HRegistry_RemoveFromSearch @@ -57,7 +57,7 @@ noremap HRegistry_ClearRegister noremap HRegistry_ActivateRegister \ :call highlight#activate_register(v:register) noremap HRegistry_CountLastSeen - \ :call highlight#count_last_pattern_seen() + \ :call highlight#count_pattern('\<'.expand('').'\>') " Normal Mappings nmap & HRegistry_AppendToSearch