Last active
April 1, 2019 04:12
-
-
Save silverAndroid/1426d35e2950e5925b830d5a62e28929 to your computer and use it in GitHub Desktop.
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
| function get_os { | |
| base=`uname` | |
| if [ $base == 'Darwin' ]; then | |
| brew install zsh zsh-completions; | |
| elif [ $base == 'Linux' ]; then | |
| os=`lsb_release -i | cut -f 2-` | |
| if [ $os == 'Ubuntu' ]; then | |
| sudo apt install zsh -y; | |
| elif [ $os == 'Fedora' ]; then | |
| sudo dnf install zsh -y; | |
| elif [ $os == 'Arch' ]; then | |
| sudo pacman -S zsh; | |
| else | |
| echo "Unsupported OS" | |
| exit 1 | |
| fi | |
| else | |
| echo "Unsupported OS" | |
| exit 1 | |
| fi | |
| } | |
| function get_zsh_version { | |
| zsh_version=`zsh --version | cut -f 2 -d ' '` | |
| } | |
| function install_powerline_fonts { | |
| wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf | |
| mkdir ~/.fonts | |
| mv PowerlineSymbols.otf ~/.fonts | |
| fc-cache -vf ~/.fonts/ | |
| wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf | |
| mkdir ~/.config | |
| mkdir ~/.config/fontconfig | |
| mkdir ~/.config/fontconfig/conf.d | |
| mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d | |
| } | |
| function install_powerline { | |
| alias pip=pip3 | |
| echo "Updating pip..." | |
| pip install --upgrade pip | |
| echo "Installing powerline-status..." | |
| pip install powerline-status | |
| echo "Setting up powerline-status..." | |
| install_powerline_fonts | |
| python_location=`pip show powerline-status | grep "Location" | cut -f 2- -d ' '` | |
| echo "set rtp+=$python_location/powerline/bindings/vim/ | |
| set laststatus=2 | |
| set t_Co=256" > ~/.vimrc | |
| } | |
| function install_powerlevel_9k { | |
| echo "Installing powerlevel9k..." | |
| git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k | |
| sed -E 's/ZSH_THEME=.+/ZSH_THEME="powerlevel9k\/powerlevel9k"/' -i.backup ~/.zshrc | |
| echo "Now log out and log back in for the changes to apply!" | |
| } | |
| echo "Checking for ZSH..." | |
| if ! type zsh > /dev/null; then | |
| echo "Can't find ZSH...installing now"; | |
| install_zsh; | |
| echo "Verifying installation" | |
| echo "Installation successful" | |
| echo "Changing shell to ZSH. After this script has finished, log out and log back in..." | |
| chsh -s $(which zsh) | |
| else | |
| echo "Found ZSH"; | |
| get_zsh_version; | |
| fi | |
| echo "Checking for Oh My Zsh..." | |
| cd ~ | |
| if [[ $(find "." -name ".oh-my-zsh") ]]; then | |
| echo 'Oh My Zsh found' | |
| else | |
| echo 'Could not find Oh My Zsh' | |
| echo "Installing Oh My Zsh..." | |
| sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | |
| fi | |
| echo "Checking for powerline..." | |
| if [[ $(pip show powerline_status) ]]; then | |
| echo "powerline found" | |
| else | |
| echo "Could not find powerline" | |
| echo "Would you like to install powerline? (Y if yes) See https://github.com/powerline/powerline for more details..." | |
| read answer | |
| if [ $answer == 'Y' ]; then | |
| install_powerline; | |
| fi | |
| fi | |
| echo 'Checking for powerlevel9k...' | |
| if [[ $(find "./.oh-my-zsh" -name 'powerlevel9k') ]]; then | |
| echo "powerlevel9k found" | |
| else | |
| echo 'Could not find powerlevel9k' | |
| echo 'Would you like to install powerlevel9k? (Y if yes) See https://github.com/bhilburn/powerlevel9k for more details...' | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment