-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.sh
executable file
·45 lines (32 loc) · 1.39 KB
/
tmux.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /usr/bin/env sh
SESSION_NAME="C"
# Check if the session already exists
tmux has-session -t $SESSION_NAME
# If the session doesn't exist, create it
if [ $? != 0 ]; then
# Start a new session
tmux new-session -d -s $SESSION_NAME
# Rename the first window to "Main Window"
tmux rename-window -t $SESSION_NAME:0 'Main Window'
# Split the window into two vertical panes: left (CODE) and right (TASKS + empty space)
tmux split-window -h -t $SESSION_NAME:0
# Resize the left pane (CODE) to take up approximately 40% of the screen
tmux resize-pane -R 40 # Shrink the right pane, make left larger
# In the left pane (CODE), run neovim or another editor
tmux send-keys -t $SESSION_NAME:0.0 'cd src; nvim' C-m # Open neovim in CODE
# In the right pane, split it into two vertical panes (TASKS and empty space)
tmux split-window -v -t $SESSION_NAME:0.1
# Resize the bottom right pane to take up more space
tmux resize-pane -U 10 # Expand the bottom pane
# Change to working directory for the first window (CODE)
tmux send-keys -t $SESSION_NAME:0.1 'cd tasks' C-m
# In the top-right pane (TASKS), open neovim
tmux send-keys -t $SESSION_NAME:0.1 'nvim' C-m # Open TASK
# Focus pane 0
tmux select-pane -t $SESSION_NAME:0.0
# Attach to the session
tmux attach-session -t $SESSION_NAME
else
# If the session exists, just attach to it
tmux attach-session -t $SESSION_NAME
fi