44 lines
1.4 KiB
Text
44 lines
1.4 KiB
Text
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 %{
|
|
fish [code]: Execute provided fish code, evaluating its output as Kakoune commands.
|
|
} %{
|
|
evaluate-commands %sh{
|
|
vars=$(
|
|
printf %s "$1" | grep -o 'kak_\w*' | sort -u | tr '\n' ' '
|
|
)
|
|
# 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 %{
|
|
fish-keys [code]: Execute provided fish code, executing its output with execute-keys.
|
|
} %{
|
|
execute-keys %sh{
|
|
fish -c "eval $@"
|
|
}
|
|
}
|
|
|
|
require-module fish
|
|
require-module kak
|
|
|
|
add-highlighter shared/kakrc/code/fish regex (?:\s|\A)\K(fish|fish-keys)(?:(?=\s)|\z) 0:keyword
|
|
add-highlighter shared/kakrc/fish1 region -recurse '\{' '(^|\h)(fish|fish-keys)([\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/fish3 region -recurse '\[' '(^|\h)(fish|fish-keys)([\s{}\w%/$-|''"])* %\[\K' '\]' ref fish
|
|
add-highlighter shared/kakrc/fish4 region -recurse '<' '(^|\h)(fish|fish-keys)([\s{}\w%/$-|''"])* %<\K' '>' ref fish
|
|
~
|