mirror of
https://github.com/opdavies/build-configs.git
synced 2025-01-22 18:27:31 +00:00
Add .tmux script
[ci skip]
This commit is contained in:
parent
de990f3836
commit
0d622d3121
27
.tmux
Executable file
27
.tmux
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
|
||||||
|
session_name="${1:-'build-configs'}"
|
||||||
|
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 +GoToFile" Enter
|
||||||
|
|
||||||
|
# 2. General shell use.
|
||||||
|
tmux new-window -t "${session_name}" -c "${session_path}"
|
||||||
|
|
||||||
|
if [[ -n "${TMUX:-}" ]]; then
|
||||||
|
tmux switch-client -t "${session_name}"
|
||||||
|
tmux select-window -t "${session_name}:vim.left"
|
||||||
|
else
|
||||||
|
tmux attach -t "${session_name}:vim.left"
|
||||||
|
fi
|
Loading…
Reference in a new issue