shell script based session management

This commit is contained in:
2025-10-11 16:32:39 +02:00
parent 9dcdc2a6e6
commit 9146724e6c
4 changed files with 56 additions and 0 deletions
+1
View File
@@ -18,6 +18,7 @@ bind c-l select-pane -R
bind c-g popup -E -w 100% -h 100% -d "#{pane_current_path}" -b rounded lazygit
bind c-k popup -E -w 100% -h 100% -b rounded "tmux list-keys | fzf"
bind c-t popup -E -w 100% -h 100% -b rounded -d "#{pane_current_path}"
bind c-s popup -E -w 100% -h 100% -b rounded "sh $HOME/choose-session.sh"
set -g default-terminal "tmux-256color"
set -as terminal-overrides ",xterm-256color:Tc"
+4
View File
@@ -0,0 +1,4 @@
SESSION_FILE=$(ls "$HOME/tmux" | fzf)
if [ -n "$SESSION_FILE" ]; then
sh "$HOME/tmux/$SESSION_FILE"
fi
+22
View File
@@ -0,0 +1,22 @@
SESSION="edit sessions"
if tmux has-session -t "$SESSION" 2>/dev/null; then
if [ -n "$TMUX" ]; then
tmux switch-client -t "$SESSION"
else
tmux attach -t "$SESSION"
fi
exit 0
fi
tmux new-session -d -s "$SESSION" -c ~/tmux/ -n "nvim"
tmux send-keys -t "$SESSION":"nvim" 'nvim .' C-m
tmux new-window -t "$SESSION" -c ~/tmux/
tmux select-window -t "$SESSION":"nvim"
if [ -n "$TMUX" ]; then
tmux switch-client -t "$SESSION"
else
tmux attach -t "$SESSION"
fi