Skip to content

Instantly share code, notes, and snippets.

@josephbuchma
Last active April 18, 2016 15:46
Show Gist options
  • Save josephbuchma/69eb0c387d0b8c86cd3a to your computer and use it in GitHub Desktop.
Save josephbuchma/69eb0c387d0b8c86cd3a to your computer and use it in GitHub Desktop.
Install prezto for zsh, tmux and vim with plugins
#!/bin/zsh
# This script installs prezto for zsh, Tmux and Vim with plugins
# run with sudo
# Tested on Ubuntu 14.04
#
# Author: Joseph Buchma
cd
echo 'Installing prezto for zsh'
echo '==================================='
sudo -u $SUDO_USER git clone --recursive https://github.com/JosephBuchma/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
setopt EXTENDED_GLOB
rm .zlogin .zlogout .zpreztorc .zprofile .zshenv .zshrc > /dev/null 2>&1
echo 'Linking config files from zpresto'
echo '================================='
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
echo "$rcfile was linked to ${ZDOTDIR:-$HOME}/.${rcfile:t}"
sudo -u $SUDO_USER ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
echo 'Setting /bin/zsh as default shell'
echo '================================='
chsh -s /bin/zsh
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
# required for some vim plugin (forgot what exactly)
apt-get install ctags
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' >> .zshrc
# 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' >> .zshrc
# 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 'Prezto for zsh, Tmux and Vim with plugins are being successfully installed!'
echo '==========================================================================='
echo 'installing i3wm'
sudo -u $SUDO_USER apt-get install i3
# Finish! Enjoy :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment