From 205558b999d5deb921cea41bc8ab4eb7dc736d5e Mon Sep 17 00:00:00 2001 From: crater2150 <crater@qwertyuiop.de> Date: Tue, 30 May 2023 10:50:45 +0200 Subject: [PATCH] Replace tmux split editing with kitty split --- bindings.zsh | 3 ++- .../{edit-command-line-tmux => edit-command-line-split} | 8 +++----- 2 files changed, 5 insertions(+), 6 deletions(-) rename widgets/{edit-command-line-tmux => edit-command-line-split} (54%) diff --git a/bindings.zsh b/bindings.zsh index aea5cd8..c3a76ef 100644 --- a/bindings.zsh +++ b/bindings.zsh @@ -1,4 +1,5 @@ #!/bin/zsh +fpath=( "${ZDOTDIR:+$ZDOTDIR/widgets}" $fpath ) bindkey -v @@ -31,7 +32,7 @@ bindkey " " magic-space # Do history expansion on space. bindkey $'\177' backward-delete-char # backspace bindkey $'\10' backward-delete-word # C-backspace -bindkey -M vicmd ! edit-command-line-tmux +bindkey -M vicmd ! edit-command-line-split #unicode input autoload -U insert-unicode-char diff --git a/widgets/edit-command-line-tmux b/widgets/edit-command-line-split similarity index 54% rename from widgets/edit-command-line-tmux rename to widgets/edit-command-line-split index bd8652a..7ef82e1 100644 --- a/widgets/edit-command-line-tmux +++ b/widgets/edit-command-line-split @@ -1,13 +1,11 @@ -ECLHEIGHT=${ECLHEIGHT:-5} edit-command-line-tmux() { local tmpfile=${TMPPREFIX:-/tmp/zsh}ecl$$ print -R - "$PREBUFFER$BUFFER" >$tmpfile exec </dev/tty - if [ -n "$TMUX" ] && [ "$UID" -ne 0 ]; then - tmux splitw -v -l $ECLHEIGHT "vim -c 'set laststatus=0 showtabline=0 ft=zsh' $tmpfile" - pid=$(ps -ef | awk "/[0-9] vim.*${tmpfile:t}/ { print \$2 }") - wait_on_pid $pid + if [[ $KITTY_WINDOW_ID ]]; then + kitty @launch --type overlay vim -c 'set laststatus=0 showtabline=0 ft=zsh' $tmpfile + tail -f --pid=$(pgrep -f "vim.*${tmpfile:t}") /dev/null else ${=${VISUAL:-${EDITOR:-vi}}} $tmpfile fi