Replace tmux split editing with kitty split

This commit is contained in:
crater2150 2023-05-30 10:50:45 +02:00
parent b3758b0c8e
commit 205558b999
2 changed files with 5 additions and 6 deletions

View file

@ -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

View file

@ -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