-
Notifications
You must be signed in to change notification settings - Fork 520
/
Copy pathdevcontainer_postCreateCommand.sh
executable file
·47 lines (34 loc) · 1.76 KB
/
devcontainer_postCreateCommand.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
46
47
#!/usr/bin/env bash
# Devcontainer postCreateCommand.
# Install dependencies for running this project in GitHub Codespaces.
TMUX_POWERLINE_PATH="/workspaces/tmux-powerline"
set -eux
# For git version tagging:
go install github.com/maykonlsf/semver-cli/cmd/semver@latest
# Defensive (aggressive?) sysop: in case user's dotfiles installed tmux configs already.
# NOTE unfortunately there is not devcontainer command that runs after the setup of dotfiles. So these rm's might not have the intended effect... Just run this script manually once if you happen to have any own tmux confs installed via dotfiles in your Codespaces. Ref: https://containers.dev/implementors/json_reference/#lifecycle-scripts
## Tmux
rm -rf "${XDG_CONFIG_HOME:-$HOME/.config}"/tmux
rm -rf "$HOME"/.tmux
## tmux-powerline
rm -rf "${XDG_CONFIG_HOME:-$HOME/.config}"/tmux-powerline
rm -rf "$HOME"/.tmux-powerline
rm -f "$HOME"/.tmuxpowerlinerc
# Set up TPM. Ref: https://github.com/tmux-plugins/tpm?#installation
git clone https://github.com/tmux-plugins/tpm "$HOME"/.tmux/plugins/tpm
cat << TMUXCONF > "$HOME"/.tmux.conf
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
# Install tmux-powerline as a "local plugin". Ref: https://github.com/tmux-plugins/tpm/issues/220#issuecomment-1082686994
run '${TMUX_POWERLINE_PATH}/main.tmux'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
TMUXCONF
# Install TPM plugins
"$HOME"/.tmux/plugins/tpm/bin/install_plugins
# Set up config:
$TMUX_POWERLINE_PATH/generate_config.sh
mv "$HOME/.config/tmux-powerline/config.sh.default" "$HOME/.config/tmux-powerline/config.sh"
# Set up theme:
mkdir -p "$HOME/.config/tmux-powerline/themes"
cp "$TMUX_POWERLINE_PATH/themes/default.sh" "$HOME/.config/tmux-powerline/themes/"