dotfiles/.tmux

24 lines
546 B
Plaintext
Raw Normal View History

2023-12-14 08:58:05 +00:00
#!/usr/bin/env bash
set -o errexit
set -o nounset
2024-01-25 22:57:11 +00:00
session_name="${1:-dotfiles-nix}"
2023-12-14 08:58:05 +00:00
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
tmux send-keys -t "${session_name}:vim" "nvim" Enter
2023-12-14 08:58:05 +00:00
# 2. General shell use.
tmux new-window -t "${session_name}" -c "${session_path}"
2023-12-19 10:53:49 +00:00
tmux switch-client -t "${session_name}:vim.left" ||
2023-12-14 08:58:05 +00:00
tmux attach -t "${session_name}:vim.left"