dotfiles/.config/kak/autoload/hop.kak

39 lines
1.1 KiB
Text

# https://git.sr.ht/~hadronized/hop.kak
evaluate-commands %sh{ hop-kak --init }
declare-option str hop_kak_keyset 'tnserigmaodhcxplfuwyqz'
# select visible buffer
map global normal <a-%> ':execute-keys gtGbx<ret>'
define-command hop-kak %{
evaluate-commands -no-hooks -- %sh{
hop-kak --keyset "$kak_opt_hop_kak_keyset" --sels "$kak_selections_desc"
}
}
define-command -override hop-kak-words %{
eval "ui-scrolloff-disable"
try %{ ui-wrap-disable }
map window normal <esc> ': trigger-user-hook donehop<ret><esc>'
map window normal , ': trigger-user-hook donehop<ret>,'
hook -once window User donehop %{
eval "ui-scrolloff-enable"
try %{ ui-wrap-enable }
unmap window normal <esc>
unmap window normal ,
}
execute-keys 'gtGbxs\w+<ret>: hop-kak<ret>'
}
declare-user-mode hop
map -docstring %{
Filter visible words
} global hop w ': hop-kak-words<ret>'
map -docstring %{
Filter selection
} global hop s ': hop-kak<ret>'
map -docstring %{
Hop mode
} global normal <ret> ': enter-user-mode hop<ret>'