-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux-powerline-setup.sh
executable file
·62 lines (52 loc) · 1.83 KB
/
tmux-powerline-setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
# Install Powerline-tmux
# Check for prerequisites
TMUX_VERSION=$(tmux -V | awk '{print $2}')
# This is sloppy, but should catch most offenders
isXltY() {
awk -v x="$1" -v y="$2" 'BEGIN {printf (x<y?"0":"1") "\n", x, y}';
}
TMUX_OUTDATED=$(isXltY 2.1 "$TMUX_VERSION")
if [ $TMUX_VERSION == "master" ]; then
echo "tmux is running on latest."
elif [ $TMUX_OUTDATED ]; then
echo "tmux-powerline requires tmux 2.1+"
echo "please update tmux and then try again"
exit 1
fi
if [ -d ~/projects/tmux-powerline/ ]; then
echo "tmux-powerline already installed!"
echo "please uninstall and then try again"
exit 1
fi
if [[ $OSTYPE == darwin* ]]; then
echo "tmux-powerline: installing alternative grep via homebrew"
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/grep.rb
fi
if [ ! -d ~/projects ]; then
echo "tmux-powerline: git projects directory not found. creating ~/projects/"
mkdir ~/projects
fi
echo "tmux-powerline: installing fonts"
echo "Please note, you may still need to change your terminal to use these fonts"
OLDPWD=$(pwd)
# clone
git clone https://github.com/powerline/fonts.git --depth=1 /tmp/powerline-fonts
# install
cd /tmp/powerline-fonts
./install.sh
# clean-up a bit
cd $OLDPWD
rm -rf /tmp/powerline-fonts/
echo "tmux-powerline: downloading scripts"
git clone https://github.com/agrahamlincoln/tmux-powerline.git ~/projects/tmux-powerline
echo "tmux-powerline: configuring powerline in ~/.tmux.conf"
cat >> ~/.tmux.conf <<EOF
set-option -g status on
set-option -g status-interval 2
set-option -g status-justify "centre"
set-option -g status-left-length 60
set-option -g status-right-length 90
set-option -g status-left "#(~/projects/tmux-powerline/powerline.sh left)"
set-option -g status-right "#(~/projects/tmux-powerline/powerline.sh right)"
EOF