aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Mario <marioortizmanero@gmail.com>2020-06-10 02:26:15 +0200
committerGravatar GitHub <noreply@github.com>2020-06-10 05:56:15 +0530
commit9130db3e75e3393eaf50c0c6095ff56c0f8aa7f3 (patch)
tree00e8090e4a140cde04991e54354ea05a4e730fb6 /plugins
parent5a6078967b9ea2d71c636073ab27c298404ff661 (diff)
downloadnnn-9130db3e75e3393eaf50c0c6095ff56c0f8aa7f3.tar.gz
Kitty splits (#643)
* Easier to browse plugin README.md * Splits are inverted * trying to fix kitty splits * Correctly restores the kitty layout * More clear comments
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/preview-tui13
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/preview-tui b/plugins/preview-tui
index a7b1101..86260eb 100755
--- a/plugins/preview-tui
+++ b/plugins/preview-tui
@@ -182,6 +182,13 @@ if [ "$PREVIEW_MODE" ] ; then
while read -r selection ; do
preview_file "$selection"
done
+
+ # Restoring the previous layout for kitty users. This will only work for
+ # kitty >= 0.18.0.
+ if [ "$TERMINAL" = "kitty" ]; then
+ kitty @ last-used-layout --no-response >/dev/null 2>&1
+ fi
+
exit 0
fi
@@ -191,7 +198,8 @@ if [ "$TERMINAL" = "tmux" ]; then
tmux split-window -e "NNN_FIFO=$NNN_FIFO" -e "PREVIEW_MODE=1" -d"$SPLIT" "$0" "$1"
elif [ "$TERMINAL" = "kitty" ]; then
- # Setting the layout for the new window.
+ # Setting the layout for the new window. It will be restored after the
+ # script ends.
kitty @ goto-layout splits >/dev/null
# Trying to use kitty's integrated window management as the split window.
@@ -202,9 +210,6 @@ elif [ "$TERMINAL" = "kitty" ]; then
--env "PREVIEW_MODE=1" --env "PAGER=$PAGER" \
--env "USE_SCOPE=$USE_SCOPE" --env "SPLIT=$SPLIT" \
--location "${SPLIT}split" "$0" "$1" >/dev/null
-
- # Restoring the previous layout.
- kitty @ last-used-layout --no-response >/dev/null 2>&1
else
PREVIEW_MODE=1 $TERMINAL -e "$0" "$1" &
fi