AutoYADM commit: 2025-07-01 15:39:41
This commit is contained in:
parent
163abe5562
commit
378349c544
1 changed files with 14 additions and 3 deletions
|
@ -35,21 +35,32 @@ provide-module search-highlight %—
|
|||
try %{
|
||||
%opt{search_highlight_status}
|
||||
} catch %{
|
||||
map window prompt <esc> '<a-;>: set-option window search_highlight_quit true<ret>'
|
||||
# if not, add the highlighter
|
||||
# if the user escapes search, we should immediately clear the highlight
|
||||
# in normal mode so we set the flag before escaping
|
||||
# map window prompt <esc> '<a-;>: set-option window search_highlight_quit true<ret><esc>'
|
||||
# if not already enabled, add the highlighter
|
||||
add-highlighter window/search-highlight dynregex '%reg{/}' %exp{0:%opt{search_highlight_face}}
|
||||
# update status tracker
|
||||
set-option window search_highlight_status 'search-highlight-on'
|
||||
|
||||
# register hook to clear highlighter after leaving search
|
||||
hook -once -group search-highlight window NormalIdle .* %{
|
||||
# check if user escaped search
|
||||
try %{
|
||||
%opt{search_highlight_quit}
|
||||
# if so, clear immediately
|
||||
search-highlight-clear
|
||||
} catch %{
|
||||
map window normal <esc> ': search-highlight-clear<ret>'
|
||||
# otherwise, we clear on escape
|
||||
hook -once -group search-highlight window NormalKey <esc> %{
|
||||
search-highlight-clear
|
||||
}
|
||||
}
|
||||
# clear the prompt mapping so it doesn't conflict with
|
||||
# other prompt types
|
||||
unmap window prompt <esc>
|
||||
# reset the quit-early flag
|
||||
set-option window search_highlight_quit false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue