-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhttp-2
60 lines (53 loc) · 1.8 KB
/
http-2
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
#!/usr/bin/env zsh
# This example builds off of http-1. Relative to that example, this wenv's
# initial layout is more elaborate. Additionally, the values in some of the
# entries of wenv_files are defined a more maintainable way.
#
# The directory tree for this project looks like:
#
# $ tree
# .
# ├── css
# │ └── styles.css
# ├── index.html
# └── js
# └── main.js
#
# Take a look at startup_wenv(). Here are the steps it executes
#
# 1. Rename the current window to 'js', to signify that it will primarily be
# used for editing Javascript files.
# 2. Create a new pane below the current one, set its height to 7, and start a
# Python HTTP server in this new pane.
# 3. Select the original pane (which is above the current one).
# 4. Create a new window called 'html-css', and use edit() to open the HTML and
# CSS files for the project.
# 5. Select the first window by its name, 'js'.
# 6. Use edit() to open the Javascript file.
#
# After startup_wenv() runs, we'll have two windows: the first named 'js' with
# the Javascript file open in the larger top pane and HTTP server in the bottom
# pane, and the second named 'html-css' with the HTML and CSS files open.
wenv_dir="$HOME/scratch/webdev-practice"
wenv_deps=()
wenv_extensions=('c' 'edit')
startup_wenv() {
tmux rename-window js
tmux split
tmux resize-pane -y 7
tmux send-keys 'python -m http.server' 'Enter'
tmux select-pane -U
tmux new -n html-css 'edit html css'
tmux select-window -t js
edit js
}
shutdown_wenv() {}
bootstrap_wenv() {}
((only_load_wenv_vars == 1)) && return 0
declare -Ag wenv_dirs
wenv_dirs[js]='src/js'
wenv_dirs[css]='src/css'
declare -Ag wenv_files
wenv_files[html]='index.html'
wenv_files[js]="${wenv_dirs[js]}/scripts.js"
wenv_files[css]="${wenv_dirs[css]}/styles.css"