AutoYADM commit: 2025-05-18 18:24:39

This commit is contained in:
Daniel Fichtinger 2025-05-18 18:24:39 -04:00
parent c2269876a8
commit 89c6f5970a
2 changed files with 16 additions and 37 deletions

View file

@ -1,44 +1,24 @@
provide-module fishr %~ provide-module fishr %~
def sh -params .. %{
eval eval "%%sh{""$@"" # %sh{printf '%s ' ""$@"" | grep -o 'kak_\w\+' | tr '\n' ' '}}"
}
def fishtest %{
sh fish -c %{
echo "info -- $kak_buffile"
notify-send "$kak_buffile"
}
}
define-command fish -params 1.. -docstring %{ define-command fish -params 1.. -docstring %{
fish [code]: Execute provided fish code, evaluating its output as Kakoune commands. fish [code]: Execute provided fish code, evaluating its output as Kakoune commands.
} %{ } %{
evaluate-commands %sh{ evaluate-commands %sh{
vars=$( quote() {
printf %s "$1" | grep -o 'kak_\w*' | sort -u | tr '\n' ' ' printf "'%s'" "$(printf "%s" "$1" | sed "s/'/'\\\\''/g")"
)
# notify-send "$1"
tmp="$(mktemp)"
printf "%s\n%s" "#!/bin/env fish" "$1">"$tmp"
printf %s "eval %sh{ fish $tmp # $vars } ">/tmp/fish-test
}
} }
define-command fish-keys -params 1.. -docstring %{ cmd=$(quote "$*")
fish-keys [code]: Execute provided fish code, executing its output with execute-keys. vars=$(printf '%s\n' "$@" | grep -o 'kak_\w\+' | tr '\n' ' ')
} %{ printf "eval %%sh{fish -c %s # %s}" "$cmd" "$vars"
execute-keys %sh{
fish -c "eval $@"
} }
} }
require-module fish require-module fish
require-module kak require-module kak
add-highlighter shared/kakrc/code/fish regex (?:\s|\A)\K(fish|fish-keys)(?:(?=\s)|\z) 0:keyword add-highlighter shared/kakrc/code/fish regex (?:\s|\A)\K(fish)(?:(?=\s)|\z) 0:keyword
add-highlighter shared/kakrc/fish1 region -recurse '\{' '(^|\h)(fish|fish-keys)([\s{}\w%/$-|''"])* %\{\K' '\}' ref fish add-highlighter shared/kakrc/fish1 region -recurse '\{' '(^|\h)(fish)([\s{}\w%/$-|''"])* %\{\K' '\}' ref fish
add-highlighter shared/kakrc/fish2 region -recurse '\(' '(^|\h)(fish|fish-keys)([\s{}\w%/$-|''"])* %\(\K' '\)' ref fish add-highlighter shared/kakrc/fish2 region -recurse '\(' '(^|\h)(fish)([\s{}\w%/$-|''"])* %\(\K' '\)' ref fish
add-highlighter shared/kakrc/fish3 region -recurse '\[' '(^|\h)(fish|fish-keys)([\s{}\w%/$-|''"])* %\[\K' '\]' ref fish add-highlighter shared/kakrc/fish3 region -recurse '\[' '(^|\h)(fish)([\s{}\w%/$-|''"])* %\[\K' '\]' ref fish
add-highlighter shared/kakrc/fish4 region -recurse '<' '(^|\h)(fish|fish-keys)([\s{}\w%/$-|''"])* %<\K' '>' ref fish add-highlighter shared/kakrc/fish4 region -recurse '<' '(^|\h)(fish)([\s{}\w%/$-|''"])* %<\K' '>' ref fish
~ ~

View file

@ -2,10 +2,9 @@ eval %sh{ kak-tree-sitter -vvvvv -dks --init $kak_session }
colorscheme ashen colorscheme ashen
require-module fishr require-module fishr
def fishtest %{ define-command fish-test %{
sh fish -c %{ fish %{
echo "info -- $kak_buffile" notify-send $kak_buffile
notify-send "$kak_buffile"
} }
} }