fix(fish): improved tmux_sessionizer tmux_attach

This commit is contained in:
Léana 江 2023-04-02 15:26:52 +02:00
parent 8a04e17d9d
commit a98530a3eb
3 changed files with 7 additions and 6 deletions

View file

@ -1,9 +1,9 @@
function tmux_attach
if test -z $argv
set -f cmd "fish"
set cmd "fish"
else
set -f cmd "$argv"
set cmd "$argv"
end
set -f choice (string join ';' "new" (tmux list-sessions -F "#{session_name}") | tr ';' '\n' | fzf)

View file

@ -6,12 +6,12 @@ function tmux_sessionizer --description 'manage tmux sessions'
tmux start-server
if test -z $argv
set -f cmd "fish"
set cmd "fish"
else
set -f cmd "$argv"
set cmd "$argv"
end
if not tmux has-session -t "$PWD" > /dev/null 2>&1
if not tmux list-sessions -F '#{session_name}' | rg "^$PWD\$" > /dev/null
# create new session and attach to it
tmux new-session -s "$PWD" "$cmd"
else