AutoYADM commit: 2025-06-26 14:29:23

This commit is contained in:
Daniel Fichtinger 2025-06-26 14:29:23 -04:00
parent 75e9c827a7
commit 2dd6e745af
2 changed files with 21 additions and 8 deletions

View file

@ -10,23 +10,33 @@ provide-module search-highlight %—
def -hidden -override search-highlight-on nop def -hidden -override search-highlight-on nop
def -hidden -override search-highlight-off fail def -hidden -override search-highlight-off fail
# enable the plugin
define-command -hidden search-highlight-enable-impl %{ define-command -hidden search-highlight-enable-impl %{
# register hook to show highlighting during search
hook -group search-highlight window RegisterModified '/' %{ hook -group search-highlight window RegisterModified '/' %{
# check whether already enabled
try %{ try %{
%opt{search_highlight_status} %opt{search_highlight_status}
} catch %{ } catch %{
# if not, add the highlighter
add-highlighter window/search-highlight dynregex '%reg{/}' %exp{0:%opt{search_highlight_face}} 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' set-option window search_highlight_status 'search-highlight-on'
} # register hook to clear highlighter after leaving search
} hook -once -group search-highlight window NormalIdle .* %{
hook -group search-highlight window NormalKey '<esc>' %{ try %{
try %{ # for safety; only run if highlighting is on
%opt{search_highlight_status} %opt{search_highlight_status}
remove-highlighter window/search-highlight # remove highlighter
set-option window search_highlight_status 'search-highlight-off' 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 %{ define-command -hidden search-highlight-disable-impl %{
remove-hooks window search-highlight remove-hooks window search-highlight
} }

View file

@ -124,7 +124,7 @@ set-option -add global ui_options terminal_assistant=none
set-option global tabstop 4 set-option global tabstop 4
set-option global indentwidth 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 declare-option str-list extra_kak_keywords addhl decl def compl eval exec rmhl rmhooks face set unset
eval %sh{ 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" printf '%s' "add-highlighter shared/kakrc/code/extra_keywords regex (?:\s|\A)\K($(join "${kak_opt_extra_kak_keywords}" '|'))(?:(?=\s)|\z) 0:keyword"
fi fi
} }
}
hook global WinSetOption filetype=kak %{
# make brackets gray a-la Ashen # make brackets gray a-la Ashen
add-highlighter window/bracket regex [\[\]\(\)\{\}]{1} 0:rgb:737373 add-highlighter window/bracket regex [\[\]\(\)\{\}]{1} 0:rgb:737373