tmux fix session manager
This commit is contained in:
parent
1d4cc70783
commit
5f7473dd65
2
.gitignore
vendored
2
.gitignore
vendored
@ -25,4 +25,4 @@ home/user/.config/ranger/plugins
|
|||||||
home/user/.termux/shell
|
home/user/.termux/shell
|
||||||
|
|
||||||
home/user/.tmux/*
|
home/user/.tmux/*
|
||||||
!home/user/.tmux/01.conf
|
!home/user/.tmux/01.sh
|
||||||
@ -61,13 +61,13 @@ bind-key -T prefix l confirm-before -p "lock tmux? (y/n)" lock-session
|
|||||||
bind r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded..."
|
bind r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded..."
|
||||||
|
|
||||||
# Session managment
|
# Session managment
|
||||||
bind 1 source-file ~/.tmux/01.conf
|
bind 1 run-shell ~/.tmux/01.sh
|
||||||
bind 2 source-file ~/.tmux/02.conf
|
bind 2 run-shell ~/.tmux/02.sh
|
||||||
bind 3 source-file ~/.tmux/03.conf
|
bind 3 run-shell ~/.tmux/03.sh
|
||||||
bind 4 source-file ~/.tmux/04.conf
|
bind 4 run-shell ~/.tmux/04.sh
|
||||||
bind 5 source-file ~/.tmux/05.conf
|
bind 5 run-shell ~/.tmux/05.sh
|
||||||
bind 6 source-file ~/.tmux/06.conf
|
bind 6 run-shell ~/.tmux/06.sh
|
||||||
bind 7 source-file ~/.tmux/07.conf
|
bind 7 run-shell ~/.tmux/07.sh
|
||||||
bind 8 source-file ~/.tmux/08.conf
|
bind 8 run-shell ~/.tmux/08.sh
|
||||||
bind 9 source-file ~/.tmux/09.conf
|
bind 9 run-shell ~/.tmux/09.sh
|
||||||
bind 0 source-file ~/.tmux/10.conf
|
bind 0 run-shell ~/.tmux/10.sh
|
||||||
@ -1,6 +1,10 @@
|
|||||||
# .zshrc by TheK4n
|
# .zshrc by TheK4n
|
||||||
# https://github.com/TheK4n/dotfiles
|
# https://github.com/TheK4n/dotfiles
|
||||||
|
|
||||||
|
if command -v tmux &>/dev/null && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
|
||||||
|
exec tmux
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f "$ZDOTDIR/sourcer" ]; then
|
if [ -f "$ZDOTDIR/sourcer" ]; then
|
||||||
source "$ZDOTDIR/sourcer"
|
source "$ZDOTDIR/sourcer"
|
||||||
fi
|
fi
|
||||||
@ -1,6 +0,0 @@
|
|||||||
# vim: filetype=tmux
|
|
||||||
SESSION=s01
|
|
||||||
MAINW=1
|
|
||||||
new-session -s ${SESSION} -A -n ${MAINW} -c "$WORKING_PROJECT" "$EDITOR"
|
|
||||||
send-keys -t ${SESSION}:${MAINW} , 1
|
|
||||||
splitw -t ${SESSION}:${MAINW} -d -h -l 40% -c '#{pane_current_path}'
|
|
||||||
18
home/user/.tmux/01.sh
Executable file
18
home/user/.tmux/01.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
SESSION=s01
|
||||||
|
MAINW=1
|
||||||
|
|
||||||
|
WORKING_PROJECT="$HOME/code/shell/note"
|
||||||
|
EDITOR="vi"
|
||||||
|
|
||||||
|
if ! tmux has-session -t "$SESSION"; then
|
||||||
|
tmux new-session -s "$SESSION" -d -n "$MAINW" -c "$WORKING_PROJECT"
|
||||||
|
tmux send-keys -t "$SESSION:$MAINW" "$EDITOR" Enter
|
||||||
|
tmux send-keys -t "$SESSION:$MAINW" , 1
|
||||||
|
tmux splitw -t "$SESSION:$MAINW" -d -h -l 40% -c '#{pane_current_path}'
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmux switch-client -t "$SESSION"
|
||||||
Loading…
x
Reference in New Issue
Block a user