1
0
Fork 0
mirror of synced 2024-05-24 11:10:26 -04:00
tmux-config/install.bsh
2018-05-23 10:32:20 +02:00

31 lines
752 B
Bash
Executable file

#!/bin/bash
# https://github.com/gpakosz/.tmux
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
#
# @author kidlike
set -e
WD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
INST_DIR="$HOME/.oh-my-tmux"
TMUX_CONF="$HOME/.tmux.conf"
# backup pre-existing
if [ -z "$SKIP_BACKUP" ]; then
if [ -r $TMUX_CONF ]; then
BACKUP_NAME="${TMUX_CONF}.bak.$(ls -l ${TMUX_CONF}.bak* 2>/dev/null | wc -l)"
cat $TMUX_CONF > $BACKUP_NAME
fi
fi
# skip step if already at INST_DIR
if [ "$(realpath $WD)" != "$(realpath $INST_DIR)" ]; then
rm -rf "$INST_DIR"
ln -sf "$WD" "$INST_DIR"
fi
ln -sf "$INST_DIR/tmux.conf" "$TMUX_CONF"