39 lines
1.2 KiB
Text
39 lines
1.2 KiB
Text
declare-user-mode yazi
|
|
map -docstring "Yazi" global user <space> ': enter-user-mode yazi<ret>'
|
|
|
|
define-command open-yazi-this-client %{
|
|
evaluate-commands %sh{
|
|
rm -f /tmp/yazi-path &>/dev/null
|
|
# TODO: make this use %opt{termcmd} instead
|
|
footclient -d error yazi $kak_buffile --chooser-file=/tmp/yazi-path &>/dev/null
|
|
P="$(cat /tmp/yazi-path)"
|
|
out="info -markup -title {title}Yazi"
|
|
if [ -z "$P" ]; then
|
|
echo "info -markup -title {title}Yazi 'No file selected.'"
|
|
else
|
|
echo "edit $P"
|
|
fi
|
|
}
|
|
}
|
|
map -docstring "open a file with yazi (blocking)" global yazi f ": open-yazi-this-client<ret>"
|
|
|
|
define-command spawn-yazi %{
|
|
terminal yazi
|
|
}
|
|
map -docstring "spawn yazi" global yazi <space> ': spawn-yazi<ret>'
|
|
|
|
define-command open-yazi-new-client %{
|
|
evaluate-commands %sh{
|
|
rm -f /tmp/yazi-path &>/dev/null
|
|
# TODO: make this use %opt{termcmd} instead
|
|
footclient -d error yazi $kak_buffile --chooser-file=/tmp/yazi-path &>/dev/null
|
|
P="$(cat /tmp/yazi-path)"
|
|
out="info -markup -title {title}Yazi"
|
|
if [ -z "$P" ]; then
|
|
echo "info -markup -title {title}Yazi 'No file selected.'"
|
|
else
|
|
echo "new edit $P"
|
|
fi
|
|
}
|
|
}
|
|
map -docstring "open with yazi in new client" global yazi n ': open-yazi-new-client<ret>'
|