-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathide
executable file
·123 lines (99 loc) · 3.39 KB
/
ide
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/usr/bin/env bash
#
# d8b 888
# Y8P 888
# 888
# 888 .d88888 .d88b.
# 888 d88" 888 d8P Y8b
# 888 888 888 88888888
# 888 Y88b 888 Y8b.
# 888 "Y88888 "Y8888
#
# -------------------------------------------------------------------------
# Version: 0.1
# File: ide
# Source: https://github.com/devpunks
# Author: Ahmid-Ra (github.com/snuggs)
# Maintainer: devPunks <https://github.com/devpunks>
# Description: IDE script
# -------------------------------------------------------------------------
#
# SHARING IS CARING
# - https://tmate.io/
# - https://github.com/zolrath/wemux
# - https://unix.stackexchange.com/q/2523/what-are-other-ways-to-share-a-tmux-session-between-two-users
# mkdir -p $PREFIX/var/tmux
# Splits:
# - https://unix.stackexchange.com/q/124310
# - https://gist.github.com/sdondley/b01cc5bb1169c8c83401e438a652b84e
# Use PIPES for race conditions in pane creation commands
# - https://manniwood.com/2021_08_02/fun_with_tmux.html
#
# =========================================================================
# ENV ---------------------------------------------------------------------
DELAY=0.8 # shell load wait time
NAME='devpunks' # NAME of environment
SOCKET="${HOME}/${NAME}.sock" # See tmux -L <socket> -S <sock file>
SESSION="${NAME}😈studio" # used throughout (i.e. VIM session name)
echo COLUMNS $COLUMNS
echo LINES $LINES
# SESSION -----------------------------------------------------------------
# Setup a $SESSION work space
# See tmux -L|S <socket|file> flag
# -L SOCKET NAME
# -S SOCKET PATH
# -s SESSION NAME
# -x - -y - (Current $TERM size)
tmux -C -S "$SOCKET" new-session -d -s "$SESSION" -x - -y -
echo "$SOCKET"
# DEV ---------------------------------------------------------------------
# Rename window
tmux -S "$SOCKET" rename-window 'DEV'
# Split pane vertically by 40%
tmux -S "$SOCKET" split-window -h -l 40%
sleep $DELAY
tmux -S "$SOCKET" send-keys 'git status' Enter
# Split second pane horizontally
tmux -S "$SOCKET" split-window -v -l 30%
sleep $DELAY
tmux -S "$SOCKET" send-keys 'pwd' Enter
# Split first pane horizontally
tmux -S "$SOCKET" select-pane -t 1
tmux -S "$SOCKET" split-window -t 1 -v -l 20%
sleep $DELAY
tmux -S "$SOCKET" send-keys 'clear' Enter
# Jump to first window
tmux -S "$SOCKET" select-pane -t 1
sleep $DELAY
tmux -S "$SOCKET" send-keys 'vi -S vim.session' Enter
# STATS -------------------------------------------------------------------
# Create next window
tmux -S "$SOCKET" new-window
# Rename STATS window
tmux -S "$SOCKET" rename-window 'STATS'
# Select monitor (htop) PANE & Start
tmux -S "$SOCKET" select-pane -T '?HTOP?'
sleep $DELAY
tmux -S "$SOCKET" send-keys 'monitor' Enter
# Split window
tmux -S "$SOCKET" split-window -v -l 85%
sleep $DELAY
# Start vim
tmux -S "$SOCKET" send-keys 'cd crypto && vi price' Enter
# Split pane vertically by 40%
tmux -S "$SOCKET" split-window -h -l 40%
sleep $DELAY
# Start price
tmux -S "$SOCKET" send-keys "cd crypto && watch ./price" Enter
# Split pane horizontally by 40%
tmux -S "$SOCKET" split-window -v -l 60%
sleep $DELAY
# Start network monitor
tmux -S "$SOCKET" send-keys "command ip -pretty -color -timestamp monitor" Enter
# Select editor pane
tmux -S "$SOCKET" select-pane -t 2
# Select Previous window again
tmux -S "$SOCKET" previous-window
# attach to new session
# -vv tmux-client-PID.log & tmux-server-PID.log & tmux-out-PID.log
tmux -S "$SOCKET" -vv -u2 attach -t $SESSION