Removed last pattern seen
parent
b6e562e89d
commit
e8708d3a96
|
@ -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
|
||||
|
|
|
@ -37,13 +37,13 @@ endif
|
|||
" Append Searches
|
||||
noremap <Plug>HRegistry_AppendToSearch
|
||||
\ :call highlight#append_to_search(v:register, '\<'.expand('<cword>').'\>')<Bar>
|
||||
\ call highlight#count_last_pattern_seen()<CR>
|
||||
\ call highlight#count_pattern('\<'.expand('<cword>').'\>')<CR>
|
||||
noremap <Plug>HRegistry_GlobalAppendToSearch
|
||||
\ :call highlight#append_to_search(v:register, expand('<cword>'))<Bar>
|
||||
\ call highlight#count_last_pattern_seen()<CR>
|
||||
\ call highlight#count_pattern(expand('<cword>'))<CR>
|
||||
noremap <Plug>HRegistry_VisualAppendToSearch
|
||||
\ :call highlight#append_to_search(v:register, highlight#get_visual_selection())<Bar>
|
||||
\ call highlight#count_last_pattern_seen()<CR>
|
||||
\ call highlight#count_pattern(highlight#get_visual_selection())<CR>
|
||||
|
||||
" Remove Searches
|
||||
noremap <Plug>HRegistry_RemoveFromSearch
|
||||
|
@ -57,7 +57,7 @@ noremap <Plug>HRegistry_ClearRegister
|
|||
noremap <Plug>HRegistry_ActivateRegister
|
||||
\ :call highlight#activate_register(v:register)<CR>
|
||||
noremap <Plug>HRegistry_CountLastSeen
|
||||
\ :call highlight#count_last_pattern_seen()<CR>
|
||||
\ :call highlight#count_pattern('\<'.expand('<cword>').'\>')<CR>
|
||||
|
||||
" Normal Mappings
|
||||
nmap <silent> & <Plug>HRegistry_AppendToSearch
|
||||
|
|
Loading…
Reference in New Issue