Skip to content

Instantly share code, notes, and snippets.

@josephbuchma
Last active August 29, 2015 14:20
Show Gist options
  • Save josephbuchma/fc857d7c14c0ea2c475a to your computer and use it in GitHub Desktop.
Save josephbuchma/fc857d7c14c0ea2c475a to your computer and use it in GitHub Desktop.
Bash script for quick tmux and vim with plugins installation
#!/bin/bash
# This script setting up ready to use Tmux and Vim with plugins
# run with sudo
# Tested on Ubuntu 14.04
#
# Author: Joseph Buchma
echo 'Install Tmux'
echo '============'
apt-get install tmux
echo 'remove vim-tiny installed by default'
echo '===================================='
apt-get remove vim-tiny
echo 'install full Vim'
echo '================'
apt-get install vim
echo 'install astrails/dotvim plugins pack for Vim'
echo '============================================'
# following installation guide
# https://github.com/astrails/dotvim#installation
cd
rm -rf .vim .vimrc > /dev/null 2>&1
# for convenience let's group everything inside ~/vimrc directory
# as I also have my personal adjustments for Vim
# and other related stuff will be stored here
sudo -u $SUDO_USER mkdir vimrc
sudo -u $SUDO_USER git clone https://github.com/JosephBuchma/dotvim.git vimrc/dotvim/
sudo -u $SUDO_USER ln -sfn vimrc/dotvim .vim
sudo -u $SUDO_USER ln -sfn vimrc/dotvim/vimrc .vimrc
cd .vim
sudo -u $SUDO_USER make install
echo 'Config for Tmux'
echo '==============='
cd
sudo -u $SUDO_USER git clone https://gist.github.com/72709f7b22655f7ce339.git vimrc/tmuxconf/
rm .tmux.conf > /dev/null 2>&1
sudo -u $SUDO_USER ln -sfn vimrc/tmuxconf/tmux.conf .tmux.conf
echo 'Other adjustments'
echo '================='
cd
# At this point you can create new session in tmux
# and run vim inside. In my case I see that colors are not being displayed correctly
# so let's fix it. First of all set 256-colors mode for terminal:
sudo -u $SUDO_USER printf '\nexport TERM="xterm-256color"\n' >> .bashrc
# Also there is gotcha with freezing terminal when hitting Ctrl-s
# (which you will do quite frequently after switching from Sublime)
# here is fix
sudo -u $SUDO_USER printf 'stty -ixon\n' >> .bashrc
# also you need to add 'set t_ut=' (without quotes) to your .vimrc
# (.vimrc.after in case of using dotvim)
# see also http://snk.tuxfamily.org/log/vim-256color-bce.html
# I created gist for my .vimrc.before and .vimrc.after
# so let's clone it and link ~/.vimrc.before/after to files from repo
sudo -u $SUDO_USER git clone https://gist.github.com/650d0dd87b553ca2c8a0.git vimrc/mydotvim/
sudo -u $SUDO_USER ln -sfn vimrc/mydotvim/vimrc.before .vimrc.before
sudo -u $SUDO_USER ln -sfn vimrc/mydotvim/vimrc.after .vimrc.after
# Look for content of .vimrc.before/after below. Installation is complete!
# Just one last thing.
# Unfortunately, There is no "true" Monokai (my favorite) color scheme
# so I migrated to Solarized Dark. Let's install Solarized for Terminal too
# source: http://www.webupd8.org/2011/04/solarized-must-have-color-paletter-for.html
sudo -u $SUDO_USER wget --no-check-certificate https://raw.github.com/seebi/dircolors-solarized/master/dircolors.ansi-dark
sudo -u $SUDO_USER mv dircolors.ansi-dark .dircolors
sudo -u $SUDO_USER eval `dircolors ~/.dircolors`
cd vimrc
sudo -u $SUDO_USER git clone https://github.com/sigurdga/gnome-terminal-colors-solarized.git
cd gnome-terminal-colors-solarized
sudo -u $SUDO_USER /bin/bash set_dark.sh
echo '==========================================================================='
echo 'Tmux and Vim with plugins are being successfully installed!'
echo '==========================================================================='
# Finish! Enjoy :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment