2
2
3
3
set -e
4
4
set -u
5
+ set -o pipefail
5
6
6
7
is_app_installed () {
7
8
type " $1 " & > /dev/null
@@ -11,13 +12,13 @@ REPODIR="$(cd "$(dirname "$0")"; pwd -P)"
11
12
cd " $REPODIR " ;
12
13
13
14
if ! is_app_installed tmux; then
14
- printf " $( tput setaf 1 ) WARNING:$( tput sgr0 ) \" tmux\" command is not found. \
15
+ printf " WARNING: \" tmux\" command is not found. \
15
16
Install it first\n"
16
17
exit 1
17
18
fi
18
19
19
20
if [ ! -e " $HOME /.tmux/plugins/tpm" ]; then
20
- printf " $( tput setaf 1 ) WARNING:$( tput sgr0 ) Cannot found TPM (Tmux Plugin Manager) \
21
+ printf " WARNING: Cannot found TPM (Tmux Plugin Manager) \
21
22
at default location: \$ HOME/.tmux/plugins/tpm.\n"
22
23
git clone https://github.com/tmux-plugins/tpm ~ /.tmux/plugins/tpm
23
24
fi
@@ -26,16 +27,17 @@ if [ -e "$HOME/.tmux.conf" ]; then
26
27
printf " Found existing .tmux.conf in your \$ HOME directory. Will create a backup at $HOME /.tmux.conf.bak\n"
27
28
fi
28
29
29
- rsync -aq ./tmux/ " $HOME " /.tmux
30
+ cp -f " $HOME /.tmux.conf" " $HOME /.tmux.conf.bak" 2> /dev/null || true
31
+ cp -a ./tmux/. " $HOME " /.tmux/
32
+ ln -sf .tmux/tmux.conf " $HOME " /.tmux.conf;
30
33
31
- ln -sf --backup --suffix=.bak .tmux/tmux.conf " $HOME " /.tmux.conf;
32
-
33
- # Install TPM plugins.
34
+ # Install TPM plugins.
34
35
# TPM requires running tmux server, as soon as `tmux start-server` does not work
35
36
# create dump __noop session in detached mode, and kill it when plugins are installed
37
+ printf " Install TPM plugins\n"
36
38
tmux new -d -s __noop > /dev/null 2>&1 || true
37
39
tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH " ~/.tmux/plugins"
38
40
" $HOME " /.tmux/plugins/tpm/bin/install_plugins || true
39
41
tmux kill-session -t __noop > /dev/null 2>&1 || true
40
42
41
- printf " $( tput setaf 2 ) OK:$( tput sgr0 ) Completed\n"
43
+ printf " OK: Completed\n"
0 commit comments