AutoYADM commit: 2025-06-26 14:29:23
This commit is contained in:
parent
75e9c827a7
commit
2dd6e745af
2 changed files with 21 additions and 8 deletions
|
@ -10,23 +10,33 @@ provide-module search-highlight %—
|
|||
def -hidden -override search-highlight-on nop
|
||||
def -hidden -override search-highlight-off fail
|
||||
|
||||
# enable the plugin
|
||||
define-command -hidden search-highlight-enable-impl %{
|
||||
# register hook to show highlighting during search
|
||||
hook -group search-highlight window RegisterModified '/' %{
|
||||
# check whether already enabled
|
||||
try %{
|
||||
%opt{search_highlight_status}
|
||||
} catch %{
|
||||
# if not, 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'
|
||||
}
|
||||
}
|
||||
hook -group search-highlight window NormalKey '<esc>' %{
|
||||
try %{
|
||||
%opt{search_highlight_status}
|
||||
remove-highlighter window/search-highlight
|
||||
set-option window search_highlight_status 'search-highlight-off'
|
||||
# register hook to clear highlighter after leaving search
|
||||
hook -once -group search-highlight window NormalIdle .* %{
|
||||
try %{
|
||||
# for safety; only run if highlighting is on
|
||||
%opt{search_highlight_status}
|
||||
# remove highlighter
|
||||
remove-highlighter window/search-highlight
|
||||
# update status
|
||||
set-option window search_highlight_status 'search-highlight-off'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# remove the plugin's hooks
|
||||
define-command -hidden search-highlight-disable-impl %{
|
||||
remove-hooks window search-highlight
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ set-option -add global ui_options terminal_assistant=none
|
|||
set-option global tabstop 4
|
||||
set-option global indentwidth 4
|
||||
|
||||
hook global WinSetOption filetype=kak %{
|
||||
hook -once global WinSetOption filetype=kak %{
|
||||
declare-option str-list extra_kak_keywords addhl decl def compl eval exec rmhl rmhooks face set unset
|
||||
|
||||
eval %sh{
|
||||
|
@ -133,6 +133,9 @@ hook global WinSetOption filetype=kak %{
|
|||
printf '%s' "add-highlighter shared/kakrc/code/extra_keywords regex (?:\s|\A)\K($(join "${kak_opt_extra_kak_keywords}" '|'))(?:(?=\s)|\z) 0:keyword"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
hook global WinSetOption filetype=kak %{
|
||||
# make brackets gray a-la Ashen
|
||||
|
||||
add-highlighter window/bracket regex [\[\]\(\)\{\}]{1} 0:rgb:737373
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue