If / else statements
Kak script is fairly limited and it requires you to do things in shell blocks.
I don’t particularly like to echo all commands from an %sh {}
block, so I use this simple block to early return out of the command.
For example I only want to execute the :ide command once, for every kakoune instance.
Sometimes I am zoomed into a single window and accidentally try to execute the :ide command again.
To prevent this I use an early return.
declare-option bool is_in_ide_mode 'false'
define-command ide %{
evaluate-commands %sh{
if [ "$kak_opt_is_in_ide_mode" = "false" ]; then
echo "echo 'Switching to ide'"
else
echo "fail 'Already in ide mode'"
fi
}
set-option global is_in_ide_mode 'true'
# Actual implementation of command
}
Goto file in remote kakoune session
Start a kakoune session with kak -s <session_name> file.txt
From another terminal you can:
Using rust binaries to extent kakoune
kak-tree-sitter popup.kak