diff --git a/src_files/.config/tmux/.tmux-session-hydrate-default b/src_files/.config/tmux/.tmux-session-hydrate-default new file mode 100644 index 0000000..5e318aa --- /dev/null +++ b/src_files/.config/tmux/.tmux-session-hydrate-default @@ -0,0 +1,18 @@ +tmux_omitted_dirs=( + $HOME + $DIR_HOME_BOX + $DIR_DEV + $DIR_GIT_PROJECTS +) + +[[ ! ${tmux_omitted_dirs[(re)$(pwd)]} ]] && { + tmux new-window -d -n $EDITOR + tmux send-keys -t :$EDITOR "$EDITOR ." c-M + tmux new-window -d -n debug + tmux new-window -d -n run + tmux rename-window cmd + tmux send-keys -t :cmd "clear; [[ -d .git ]] && git status" c-M +} + +clear + diff --git a/src_files/.config/tmux/session-hydrate-files/.tmux-session-hydrate-default b/src_files/.config/tmux/session-hydrate-files/.tmux-session-hydrate-default deleted file mode 100644 index 8ab6ea1..0000000 --- a/src_files/.config/tmux/session-hydrate-files/.tmux-session-hydrate-default +++ /dev/null @@ -1,13 +0,0 @@ -tmux_omitted_dirs=( - $HOME - $DIR_HOME_BOX - $DIR_DEV - $DIR_GIT_PROJECTS -) -[[ ! ${tmux_omitted_dirs[(re)$(pwd)]} ]] && - tmux new-window -d -n cmd && - tmux rename-window $EDITOR && - $EDITOR . - -clear - diff --git a/src_files/.config/tmux/session-hydrate-files/.tmux-session-hydrate-example b/src_files/.config/tmux/session-hydrate-files/.tmux-session-hydrate-example deleted file mode 100644 index 571dc61..0000000 --- a/src_files/.config/tmux/session-hydrate-files/.tmux-session-hydrate-example +++ /dev/null @@ -1,11 +0,0 @@ -## example template - -tmux new-window -d -n cmd -tmux send-keys -t :cmd "echo 'in cmd'" c-M - -tmux new-window -d -n another -tmux send-keys -t :another "echo 'in another'" c-M - -tmux rename-window $EDITOR -$EDITOR . -clear diff --git a/src_files/.config/tmux/session-hydrate-files/.tmux-session-hydrate-listening b/src_files/.config/tmux/session-hydrate-files/.tmux-session-hydrate-listening deleted file mode 100644 index 6a43cbb..0000000 --- a/src_files/.config/tmux/session-hydrate-files/.tmux-session-hydrate-listening +++ /dev/null @@ -1,7 +0,0 @@ -tmux new-window -d -n ncspot - -tmux new-window -d -n fitness -tmux send-keys -t :fitness "cd $DIR_HOME_BOX/life/fitness/audio" c-M - -tmux rename-window ncmpcpp -ncmpcpp diff --git a/src_files/.config/tmux/session-hydrate-files/.tmux-session-hydrate-thinking b/src_files/.config/tmux/session-hydrate-files/.tmux-session-hydrate-thinking deleted file mode 100644 index 8282747..0000000 --- a/src_files/.config/tmux/session-hydrate-files/.tmux-session-hydrate-thinking +++ /dev/null @@ -1,8 +0,0 @@ -tmux rename-window drawing - -tmux new-window -n thinking -tmux send-keys -t :thinking "$EDITOR $(date "+%Y%m%d")-scratch" c-M - -tmux send-keys -t :drawing "cd $DIR_SCRATCH_DRAWINGS" c-M -tmux send-keys -t :drawing "gimp" c-M - diff --git a/src_files/.config/tmux/tmux.conf b/src_files/.config/tmux/tmux.conf index 34091c7..a09af94 100644 --- a/src_files/.config/tmux/tmux.conf +++ b/src_files/.config/tmux/tmux.conf @@ -10,6 +10,7 @@ set -g base-index 0 # unbind keys unbind-key f; unbind-key C-f; unbind-key s; unbind-key C-s unbind-key c; unbind-key n; unbind-key p +unbind-key q; unbind-key w unbind-key C-o; unbind-key C-n; unbind-key C-p; unbind-key C-l; unbind-key C-h # vim-like movement stuff @@ -25,18 +26,17 @@ bind -r l select-pane -R bind-key r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf" \; display-message "tmux.conf reloaded" # kill the current session -# TODO: would it clash with other bindings to change these to C-q and C-w ? # TODO: combine these into one command; must cover case when only 1 session remains -bind-key Q rename-session zzzz-temp-kill\; switch-client -p\; kill-session -t zzzz-temp-kill -bind-key W kill-session +bind-key q rename-session zzzz-temp-kill\; switch-client -p\; kill-session -t zzzz-temp-kill +bind-key w kill-session # creating new windows bind-key n new-window # find and switching for sessions, include using tmux-session-init bind-key C-f run-shell "tmux neww $DIR_SCRIPTS/tmux-session-init" -# bind-key C-s run-shell "tmux neww $DIR_SCRIPTS/tmux-session-init find-existing" bind-key C-s choose-session +bind-key S choose-window bind-key C-h run-shell "tmux neww $DIR_SCRIPTS/tmux-session-init hub" bind-key -r C-l switch-client -l bind-key -r C-o last-window diff --git a/src_files/.local/scripts/tmux-session-init b/src_files/.local/scripts/tmux-session-init index 8ef99eb..f058f19 100755 --- a/src_files/.local/scripts/tmux-session-init +++ b/src_files/.local/scripts/tmux-session-init @@ -5,10 +5,7 @@ tmux_switch_to() { } tmux_hydrate() { - local tmux_hydrate_files_dir="$XDG_CONFIG_HOME/tmux/session-hydrate-files" - local tmux_hydrate_path="$tmux_hydrate_files_dir/.tmux-session-hydrate-default" - [[ $1 = "thinking" ]] && tmux_hydrate_path="$tmux_hydrate_files_dir/.tmux-session-hydrate-thinking" - [[ $1 = "listening" ]] && tmux_hydrate_path="$tmux_hydrate_files_dir/.tmux-session-hydrate-listening" + local tmux_hydrate_path="$XDG_CONFIG_HOME/tmux/.tmux-session-hydrate-default" [[ -f $2/.tmux-session-hydrate ]] && tmux_hydrate_path="$2/.tmux-session-hydrate" [[ -f $tmux_hydrate_path ]] && tmux send-keys -t $1 "source $tmux_hydrate_path" c-M } @@ -27,8 +24,6 @@ tmux_target_path='' if [[ $tmux_target_path = "." ]]; then tmux_target_name=$(basename $(pwd)) && tmux_target_path=$(pwd); elif [[ $tmux_target_path = "hub" ]]; then tmux_target_name="hub" && tmux_target_path="$HOME"; -elif [[ $tmux_target_path = "thinking" ]]; then tmux_target_name="thinking" && tmux_target_path="$DIR_SCRATCH_NOTES"; -elif [[ $tmux_target_path = "listening" ]]; then tmux_target_name="listening" && tmux_target_path="$DIR_MUSIC"; elif [[ -n $tmux_target_path ]]; then tmux_target_name=$(basename "$tmux_target_path" | tr . _); fi