Last active
January 20, 2017 12:08
-
-
Save pozgo/bd5fe0de44dd0793d96d6a400f061b54 to your computer and use it in GitHub Desktop.
Tmux Installation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Supports only Linux(RedHat/Centos/Fedora) and OSX | |
# Bash Colors | |
red=`tput setaf 1` | |
green=`tput setaf 2` | |
yellow=`tput setaf 3` | |
white=`tput setaf 7` | |
bold=`tput bold` | |
reset=`tput sgr0` | |
separator=$(echo && printf '=%.0s' {1..100} && echo) | |
# Logging Finctions | |
log() { | |
if [[ "$@" ]]; then echo "${bold}${green}[LOG `date +'%T'`]${reset} $@"; | |
else echo; fi | |
} | |
install_tmux() { | |
log "Installing tmux" | |
if [ $(uname) == "Linux" ]; then | |
log "Making sure packages gcc/make/libevent/ncurses are installed" | |
yum install -y make gcc libevent-devel ncurses-devel wget net-tools | |
yum clean all | |
cd /tmp && wget https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz | |
tar zxvf tmux-2.3.tar.gz && rm -f tmux-2.3.tar.gz && cd tmux-2.3 | |
./configure && make && make install | |
cd &&* rm -rf /tmp/tmux-2.3/ | |
elif [ $(uname) == "Darwin" ]; then | |
BREW_BIN=`which brew` | |
if [[ ${BREW_BIN} == "" ]]; then | |
log "Mac Brew not installed. Please install Brew!" | |
log "Visit: http://brew.sh/ and follow instructions" | |
exit 1 | |
fi | |
brew install tmux | |
fi | |
} | |
install_tmux_tpm() { | |
log "Installing TMUX Plugin Manager" | |
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm | |
log "TPM Installed" | |
} | |
install_tmux_themes() { | |
log "Installing Themepack" | |
git clone https://github.com/jimeh/tmux-themepack.git ~/.tmux/plugins/tmux-themepack | |
log "Themepack Installed" | |
log "Donwloading patched theme" | |
curl -o ~/.tmux/plugins/tmux-themepack/powerline/block/polinux-orange.tmuxtheme https://gist.githubusercontent.com/pozgo/2d105870287f73abcea1f255a9b7368d/raw/831d716bb2e2d16953657eafcd3c6f0931832c2b/polinux-orange.tmuxtheme | |
log "Theme downloaded" | |
log "Downloading tmux config file" | |
curl -o ~/.tmux.conf https://gist.githubusercontent.com/pozgo/fea18e70455fbfba3ce3ac6f5bbae79b/raw/a31342b664803d34f0dcf6a73fac0e23153da5be/.tmux.conf | |
log "Config file downloaded" | |
} | |
if [[ $(which tmux) == "" ]]; then | |
install_tmux | |
fi | |
install_tmux_tpm | |
install_tmux_themes | |
log "Tmux installed and configured. Start using with command: tmux new -s NAME" | |
log "Install plugins by pressing prefix key and I (Ctrl+a I)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment