n: spawn new tmux processes instead of reusing old one

This commit is contained in:
yosh 2023-10-04 09:30:18 -04:00
parent 028ca79881
commit fe5cde7dff
1 changed files with 6 additions and 3 deletions

9
n
View File

@ -2,8 +2,6 @@
# nnn previewer wrapper
set -euf
[ -n "${TMUX:-}" ] && exec nnn
vars="NNN_BATTHEME=Dracula
NNN_BATSTYLE=full
"
@ -15,4 +13,9 @@ for env in $vars; do
varstring="$varstring -e $env"
done; unset IFS
tmux new $varstring -s nnn -c exec nnn "${PWD:-"$HOME"}" || tmux new-window -t nnn: nnn "${PWD:-"$HOME"}" \; a -t nnn
[ -n "${TMUX:-}" ] && exec nnn
PWD="'$(printf '%s' "$PWD" | sed "s/'/'\\\\''/g")'"
tmux new $varstring -c exec sh -c 'cd '"${PWD:-$HOME}"' && exec nnn "$@"' sh "$@"
# tmux new $varstring -s nnn -c exec nnn "${PWD:-"$HOME"}" || tmux new-window -t nnn: nnn "${PWD:-"$HOME"}" \; a -t nnn