Skip to content

Commit

Permalink
fix to restore highlight with <ESC> #74
Browse files Browse the repository at this point in the history
  • Loading branch information
haya14busa committed May 1, 2015
1 parent c8123f5 commit 5cbb059
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions autoload/incsearch.vim
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,18 @@ function! s:pattern_saver.on_enter(cmdline) abort
if ! g:incsearch#no_inc_hlsearch
let self.pattern = @/
let self.hlsearch = &hlsearch
set hlsearch | nohlsearch
if exists('v:hlsearch')
let self.vhlsearch = v:hlsearch
endif
set hlsearch | nohlsearch
endif
endfunction
function! s:pattern_saver.on_leave(cmdline) abort
if ! g:incsearch#no_inc_hlsearch && a:cmdline.exit_code()
let @/ = self.pattern
if ! g:incsearch#no_inc_hlsearch
let is_cancel = a:cmdline.exit_code()
if is_cancel
let @/ = self.pattern
endif
let &hlsearch = self.hlsearch
if exists('v:hlsearch')
let v:hlsearch = self.vhlsearch
Expand Down

0 comments on commit 5cbb059

Please sign in to comment.