From 9053dadfc323eab7777feb09726db3cd57910d5a Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 19 Jun 2018 19:39:45 +1000 Subject: [PATCH] Add kitty.kak to support kitty integration --- rc/extra/kitty.kak | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 rc/extra/kitty.kak diff --git a/rc/extra/kitty.kak b/rc/extra/kitty.kak new file mode 100644 index 00000000..4a493636 --- /dev/null +++ b/rc/extra/kitty.kak @@ -0,0 +1,24 @@ +hook global KakBegin .* %sh{ + if [ "$TERM" = "xterm-kitty" -a -z "$TMUX" ]; then + echo " + alias global new kitty-new + alias global focus kitty-focus + " + fi +} + +define-command -params .. kitty-new %{ + nop %sh{ kitty @ new-window "$(which kak)" -c $kak_session -e "$*" } +} + +define-command -params ..1 -client-completion \ + -docstring %{kitty-focus []: focus the given client +If no client is passed then the current one is used} \ + kitty-focus %{ evaluate-commands %sh{ + if [ $# -eq 1 ]; then + printf %s\\n "evaluate-commands -client '$1' focus" + else + kitty @ focus-window -m=id:$kak_client_env_KITTY_WINDOW_ID + fi + } +}