From 0ac8b7aa54dfbc1248c5921299c7f84b01f384c6 Mon Sep 17 00:00:00 2001 From: Nizamuddin Sulieman Date: Thu, 2 Feb 2023 16:14:56 +0800 Subject: [PATCH] feat(preview-tui): add `wezterm` support --- plugins/preview-tui | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/preview-tui b/plugins/preview-tui index 03239f41..9e9c3e0b 100755 --- a/plugins/preview-tui +++ b/plugins/preview-tui @@ -114,6 +114,8 @@ start_preview() { TERMINAL=tmux elif [ -n "$KITTY_LISTEN_ON" ]; then TERMINAL=kitty + elif [ -n "$WEZTERM_UNIX_SOCKET" ]; then + TERMINAL=wezterm elif [ -z "$TERMINAL" ] && [ "$TERM_PROGRAM" = "iTerm.app" ]; then TERMINAL=iterm elif [ -n "$WT_SESSION" ]; then @@ -153,6 +155,15 @@ start_preview() { --env "USE_PISTOL=$USE_PISTOL" --env "BAT_STYLE=$BAT_STYLE" \ --env "BAT_THEME=$BAT_THEME" --env "FIFOPID=$FIFOPID" \ --env "CURSEL=$CURSEL" --location "${SPLIT}split" "$0" "$1" ;; + wezterm) + if [ "$SPLIT" = "v" ]; then split="--horizontal"; else split="--bottom"; fi + PATH="$PATH" NNN_FIFO=$NNN_FIFO PREVIEW_MODE=1 CURSEL=$CURSEL TMPDIR=$TMPDIR \ + FIFOPID=$FIFOPID BAT_STYLE=$BAT_STYLE BAT_THEME=$BAT_THEME PREVIEWPID=$PREVIEWPID \ + PAGER="$PAGER" ICONLOOKUP=$ICONLOOKUP NNN_PREVIEWWIDTH=$NNN_PREVIEWWIDTH \ + USE_SCOPE=$USE_SCOPE SPLIT=$SPLIT USE_PISTOL=$USE_PISTOL \ + NNN_PREVIEWDIR=$NNN_PREVIEWDIR NNN_PREVIEWHEIGHT=$NNN_PREVIEWHEIGHT \ + FIFO_UEBERZUG=$FIFO_UEBERZUG wezterm cli split-pane --cwd "$PWD" $split "$0" "$1"; + wezterm cli activate-pane-direction Prev ;; iterm) command="$SHELL -c 'cd $PWD; \ PATH=\\\"$PATH\\\" NNN_FIFO=\\\"$NNN_FIFO\\\" PREVIEW_MODE=1 PAGER=\\\"$PAGER\\\" \