diff --git a/.gitignore b/.gitignore index bb3d80d..849485f 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,4 @@ home/user/.config/ranger/plugins home/user/.termux/shell home/user/.tmux/* -!home/user/.tmux/01.conf \ No newline at end of file +!home/user/.tmux/01.sh \ No newline at end of file diff --git a/home/user/.config/tmux/mappings.conf b/home/user/.config/tmux/mappings.conf index 24daf23..eae8e87 100644 --- a/home/user/.config/tmux/mappings.conf +++ b/home/user/.config/tmux/mappings.conf @@ -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..." # Session managment -bind 1 source-file ~/.tmux/01.conf -bind 2 source-file ~/.tmux/02.conf -bind 3 source-file ~/.tmux/03.conf -bind 4 source-file ~/.tmux/04.conf -bind 5 source-file ~/.tmux/05.conf -bind 6 source-file ~/.tmux/06.conf -bind 7 source-file ~/.tmux/07.conf -bind 8 source-file ~/.tmux/08.conf -bind 9 source-file ~/.tmux/09.conf -bind 0 source-file ~/.tmux/10.conf \ No newline at end of file +bind 1 run-shell ~/.tmux/01.sh +bind 2 run-shell ~/.tmux/02.sh +bind 3 run-shell ~/.tmux/03.sh +bind 4 run-shell ~/.tmux/04.sh +bind 5 run-shell ~/.tmux/05.sh +bind 6 run-shell ~/.tmux/06.sh +bind 7 run-shell ~/.tmux/07.sh +bind 8 run-shell ~/.tmux/08.sh +bind 9 run-shell ~/.tmux/09.sh +bind 0 run-shell ~/.tmux/10.sh \ No newline at end of file diff --git a/home/user/.config/zsh/.zshrc b/home/user/.config/zsh/.zshrc index 9097ec5..cbe64ce 100644 --- a/home/user/.config/zsh/.zshrc +++ b/home/user/.config/zsh/.zshrc @@ -1,6 +1,10 @@ # .zshrc by TheK4n # https://github.com/TheK4n/dotfiles +if command -v tmux &>/dev/null && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then + exec tmux +fi + if [ -f "$ZDOTDIR/sourcer" ]; then source "$ZDOTDIR/sourcer" -fi +fi \ No newline at end of file diff --git a/home/user/.tmux/01.conf b/home/user/.tmux/01.conf deleted file mode 100644 index a74a57f..0000000 --- a/home/user/.tmux/01.conf +++ /dev/null @@ -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}' \ No newline at end of file diff --git a/home/user/.tmux/01.sh b/home/user/.tmux/01.sh new file mode 100755 index 0000000..e2f3892 --- /dev/null +++ b/home/user/.tmux/01.sh @@ -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" \ No newline at end of file