tmux sessions

This commit is contained in:
thek4n 2024-10-14 00:13:56 +03:00
parent 5423cd1bd1
commit c12dd2d0fa
5 changed files with 36 additions and 21 deletions

7
.gitignore vendored
View File

@ -28,6 +28,7 @@ home/user/.termux/shell
home/user/.config/tmux/plugins
home/user/.config/tmux/local.conf
!home/user/.tmux/*
!home/user/.tmux/dotfiles.sh
!home/user/.tmux/temp.sh
home/user/.tmux/*
!home/user/.tmux/dotfiles
!home/user/.tmux/temp
!home/user/.tmux/ssh

18
home/user/.tmux/dotfiles Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -x
readonly SESSION=dotfiles
readonly MAINW=1
readonly WORKING_PROJECT="${HOME}/dotfiles"
if ! tmux has-session -t "${SESSION}"; then
tmux new-session -s "${SESSION}" -d -n "${MAINW}" -c "${WORKING_PROJECT}"
tmux splitw -t "${SESSION}:${MAINW}" -d -b -h -l "${_tmux_other_pane_size}" -c '#{pane_current_path}'
tmux send-keys -t "${SESSION}:${MAINW}.1" "git pull && git push" Enter
tmux send-keys -t "${SESSION}:${MAINW}.2" '$EDITOR' Enter
tmux send-keys -t "${SESSION}:${MAINW}.2" ':Telescope find_files' Enter
fi
tmux switch-client -t "${SESSION}"

View File

@ -1,18 +0,0 @@
#!/usr/bin/env bash
set -x
SESSION=dotfiles
MAINW=1
WORKING_PROJECT="$HOME/dotfiles"
if ! tmux has-session -t "$SESSION"; then
tmux new-session -s "$SESSION" -d -n "$MAINW" -c "$WORKING_PROJECT"
tmux splitw -t "$SESSION:$MAINW" -d -b -h -l "$_tmux_other_pane_size" -c '#{pane_current_path}'
tmux send-keys -t "$SESSION:$MAINW.1" "git pull && git push" Enter
tmux send-keys -t "$SESSION:$MAINW.2" '$EDITOR' Enter
tmux send-keys -t "$SESSION:$MAINW.2" ':Telescope find_files' Enter
fi
tmux switch-client -t "$SESSION"

14
home/user/.tmux/ssh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
echo -n "ssh server: "
declare SSH_SERVER
read -r SSH_SERVER
readonly SSH_SERVER
readonly SESSION="ssh-${SSH_SERVER}"
if ! tmux has-session -t "${SESSION}"; then
tmux new-session -s "${SESSION}" -d -n "${MAINW}" -c "${WORKING_PROJECT}" "ssh ${SSH_SERVER}"
fi
tmux switch-client -t "${SESSION}"