1
0
mirror of https://github.com/samoshkin/tmux-config.git synced 2026-01-03 16:28:01 +00:00
Files
tmux-config/install.sh
2017-11-23 00:13:54 +02:00

49 lines
885 B
Bash
Executable File

#!/bin/bash
set -e
set -u
is_app_installed() {
type "$1" &>/dev/null
}
REPODIR="$(cd "$(dirname "$0")"; pwd -P)"
cd "$REPODIR";
if ! is_app_installed tmux; then
printf "$(tput setaf 1)WARNING:$(tput sgr0) \"tmux\" command is not found. \
Install it first\n"
exit 1
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
fi
if [ -e "$HOME/.tmux.conf" ]; then
printf "Found existing .tmux.conf in your \$HOME directory. Will create a backup at $HOME/.tmux.conf.bak\n"
fi
rsync -aq ./tmux/ "$HOME"/.tmux
ln -sf --backup --suffix=.bak .tmux/tmux.conf "$HOME"/.tmux.conf;
# BUG: Fix for fresh installation
"$HOME"/.tmux/plugins/tpm/bin/install_plugins
printf "$(tput setaf 2)OK:$(tput sgr0) Completed\n"