Update .tmux

This commit is contained in:
Oliver Davies 2023-12-20 00:09:57 +00:00
parent 3c0bb9f207
commit 2578c7fe6a

26
.tmux
View file

@ -1,13 +1,27 @@
#!/usr/bin/env bash
# Based on https://github.com/opdavies/dotfiles/blob/main/bin/t.
set -o errexit
set -o nounset
session_name="oliverdavies-uk"
session_name="${1:-oliverdavies_uk}"
session_path="${2:-$(pwd)}"
if tmux has-session -t="${session_name}" 2> /dev/null; then
tmux attach -t "${session_name}"
exit
fi
tmux new-session -d -s "${session_name}" -n vim -c "${session_path}"
# 1. Main window: Vim, server, shell
tmux split-pane -t "${session_name}:1" -h
tmux send-keys -t "${session_name}:1.left" "nvim +GoToFile" Enter
tmux send-keys -t "${session_name}:1.right" "./run start" Enter
tmux split-pane -t "${session_name}:1" -v
tmux send-keys -t "${session_name}:1.bottom-right" "git status --short" Enter
tmux send-keys -t "${session_name}:vim" "nvim +GoToFile" Enter
tmux split-pane -t "${session_name}:vim" -h -c "${session_path}" -p 40
tmux send-keys -t "${session_name}:vim.right" "./run start" Enter
# 2. General shell use.
tmux new-window -t "${session_name}" -c "${session_path}"
tmux switch-client -t "${session_name}:vim.left" ||
tmux attach -t "${session_name}:vim.left"