provide-module yazi %~ declare-user-mode yazi map -docstring "Yazi" global user ': enter-user-mode yazi' define-command open-yazi-this-client %{ evaluate-commands %sh{ rm -f /tmp/yazi-path >/dev/null 2>&1 # TODO: make this use %opt{termcmd} instead footclient -d error yazi $kak_buffile --chooser-file=/tmp/yazi-path >/dev/null 2>&1 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" define-command spawn-yazi %{ terminal yazi } map -docstring "spawn yazi" global yazi ': spawn-yazi' define-command open-yazi-new-client %{ evaluate-commands %sh{ rm -f /tmp/yazi-path >/dev/null 2>&1 # TODO: make this use %opt{termcmd} instead footclient -d error yazi $kak_buffile --chooser-file=/tmp/yazi-path >/dev/null 2>&1 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' ~