diff --git a/install.sh b/install.sh index d9d3525..aa3a668 100755 --- a/install.sh +++ b/install.sh @@ -18,8 +18,8 @@ fi if [ ! -e "$HOME/.tmux/plugins/tpm" ]; then printf "$(tput setaf 1)WARNING:$(tput sgr0) Cannot found TPM (Tmux Plugin Manager) \ - at default location: \$HOME/.tmux/plugins/tpm. Install it first\n" - exit 1 + at default location: \$HOME/.tmux/plugins/tpm.\n" + git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm fi if [ -e "$HOME/.tmux.conf" ]; then @@ -30,8 +30,13 @@ rsync -aq ./tmux/ "$HOME"/.tmux ln -sf --backup --suffix=.bak .tmux/tmux.conf "$HOME"/.tmux.conf; -# BUG: Fix TPM and tmux plugins for fresh installation -# "$HOME"/.tmux/plugins/tpm/bin/install_plugins +# Install TPM plugins. +# TPM requires running tmux server, as soon as `tmux start-server` does not work +# create dump __noop session in detached mode, and kill it when plugins are installed +tmux new -d -s __noop >/dev/null 2>&1 || true +tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.tmux/plugins" +"$HOME"/.tmux/plugins/tpm/bin/install_plugins || true +tmux kill-session -t __noop >/dev/null 2>&1 || true printf "$(tput setaf 2)OK:$(tput sgr0) Completed\n" @@ -45,4 +50,3 @@ printf "$(tput setaf 2)OK:$(tput sgr0) Completed\n" -