Merge branch 'blueyed-fix-highlight-restore-E416' into master
This commit is contained in:
commit
e524a3cec1
@ -3,7 +3,7 @@
|
||||
" Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com>
|
||||
" haya14busa <hayabusa1419@gmail.com>
|
||||
" Source: https://github.com/Lokaltog/vim-easymotion
|
||||
" Last Change: 07 Feb 2014.
|
||||
" Last Change: 10 Feb 2014.
|
||||
"=============================================================================
|
||||
" Saving 'cpoptions' {{{
|
||||
scriptencoding utf-8
|
||||
@ -364,6 +364,36 @@ function! s:RestoreValue() "{{{
|
||||
call s:VarReset('&virtualedit')
|
||||
call s:VarReset('&foldmethod')
|
||||
endfunction "}}}
|
||||
function! s:turn_on_hl_error() "{{{
|
||||
if exists("s:old_hl_error")
|
||||
execute "highlight Error " . s:old_hl_error
|
||||
unlet s:old_hl_error
|
||||
endif
|
||||
endfunction "}}}
|
||||
function! s:turn_off_hl_error() "{{{
|
||||
if exists("s:old_hl_error")
|
||||
return s:old_hl_error
|
||||
endif
|
||||
if hlexists("Error")
|
||||
let save_verbose = &verbose
|
||||
let &verbose = 0
|
||||
try
|
||||
redir => error
|
||||
silent highlight Error
|
||||
redir END
|
||||
finally
|
||||
let &verbose = save_verbose
|
||||
endtry
|
||||
" NOTE: do not match across newlines, to remove 'links to Foo'
|
||||
" (https://github.com/Lokaltog/vim-easymotion/issues/95)
|
||||
let hl = substitute(matchstr(error, 'xxx \zs[^\n]*'), '[ \t\n]\+\|cleared', ' ', 'g')
|
||||
if !empty(substitute(hl, '\s', '', 'g'))
|
||||
let s:old_hl_error = hl
|
||||
endif
|
||||
highlight Error NONE
|
||||
return s:old_hl_error
|
||||
endif
|
||||
endfunction "}}}
|
||||
" -- Draw --------------------------------
|
||||
function! s:SetLines(lines, key) " {{{
|
||||
for [line_num, line] in a:lines
|
||||
@ -1049,6 +1079,7 @@ function! s:EasyMotion(regexp, direction, visualmode, is_inclusive) " {{{
|
||||
" -- Reset properties -------------------- {{{
|
||||
" Save original value and set new value
|
||||
call s:SaveValue()
|
||||
call s:turn_off_hl_error()
|
||||
" }}}
|
||||
" Setup searchpos args {{{
|
||||
let search_direction = (a:direction >= 1 ? 'b' : '')
|
||||
@ -1361,6 +1392,7 @@ function! s:EasyMotion(regexp, direction, visualmode, is_inclusive) " {{{
|
||||
finally
|
||||
" -- Restore properties ------------------ {{{
|
||||
call s:RestoreValue()
|
||||
call s:turn_on_hl_error()
|
||||
call EasyMotion#reset()
|
||||
" }}}
|
||||
" -- Remove shading ---------------------- {{{
|
||||
|
Loading…
x
Reference in New Issue
Block a user