Skip to content

Instantly share code, notes, and snippets.

@ni-c
Last active April 21, 2024 19:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ni-c/f83f4389391b2a91c280201fdbd39eb4 to your computer and use it in GitHub Desktop.
Save ni-c/f83f4389391b2a91c280201fdbd39eb4 to your computer and use it in GitHub Desktop.
Oh my ZSH powerlevel 9000!
#!/bin/sh
sudo apt-get install git zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
sed -i -- 's/ZSH_THEME="robbyrussell"/plugins=(virtualenv)\nPOWERLEVEL9K_CUSTOM_LIVE="echo -n \\"\\uf525 LIVE \\uf525\\""\nPOWERLEVEL9K_CUSTOM_LIVE_BACKGROUND="red"\nPOWERLEVEL9K_CUSTOM_LIVE_FOREGROUND="white"\nPOWERLEVEL9K_MODE="nerdfont-complete"\nPOWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_live host dir vcs virtualenv)\nPOWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs load ram disk_usage time)\nZSH_THEME="powerlevel9k\/powerlevel9k"\nDEFAULT_USER=roamsys\n/g' ~/.zshrc
git clone https://github.com/zsh-users/zsh-autosuggestions.git ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
sed -i -- 's/^plugins=(/plugins=(\n zsh-autosuggestions\n zsh-syntax-highlighting\n/g' ~/.zshrc

Howto install ZSH, oh-my-zsh, powerlevel9k and nerdfonts

TL;DR

Install with:

sh -c "$(curl -fsSL https://gist.githubusercontent.com/ni-c/f83f4389391b2a91c280201fdbd39eb4/raw/ac2cbf3ccf85025d46887d124d21ee825a136fb8/install-zsh.sh)"

Client

To use powerline tools you need to install and use one of the patched nerd fonts in your beloved terminal client.

https://nerdfonts.com/

Server

ZSH

ZSH is a replacement for bash with tons of features.

sudo apt-get install zsh

oh-my-zsh

A toolsuite with a lot of plugins that make using the shell more comfortabel. Especially the git plugin is awesome!

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

https://github.com/robbyrussell/oh-my-zsh

powerlevel9k

An easy customizable theme for ZSH that gives you a lot of informations about your webserver.

git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k

https://github.com/bhilburn/powerlevel9k

~/.zshrc

The configuration file for ZSH, oh-my-zsh and powerline9k.

Add the following configuration (replace the theme block) to your .zshrc on a live server:

POWERLEVEL9K_CUSTOM_LIVE="echo -n \"\uf525 LIVE \uf525\""
POWERLEVEL9K_CUSTOM_LIVE_BACKGROUND="red"
POWERLEVEL9K_CUSTOM_LIVE_FOREGROUND="white"

POWERLEVEL9K_MODE="nerdfont-complete"
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_live host dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs load ram disk_usage time)

ZSH_THEME="powerlevel9k/powerlevel9k"
DEFAULT_USER=roamsys

zsh-autosuggestions

Fish-like autosuggestions for zsh. Do not forget to add to plugin-list in .zshrc.

git clone https://github.com/zsh-users/zsh-autosuggestions.git ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

https://github.com/zsh-users/zsh-autosuggestions

zsh-syntax-highlighting

Fish shell like syntax highlighting for Zsh. Do not forget to add to plugin-list in .zshrc.

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

https://github.com/zsh-users/zsh-syntax-highlighting.git

Optionals

zsh-ec2ssh

zsh plugin to list up EC2 instances and ssh login the instances. Do not forget to add to plugin-list in .zshrc.

sudo apt-get install peco
git clone https://github.com/h3poteto/zsh-ec2ssh.git ~/.oh-my-zsh/custom/plugins/zsh-ec2ssh

https://github.com/h3poteto/zsh-ec2ssh

Other tools

cool-peco

peco utils

sudo apt-get install peco
git clone https://github.com/ryoppy/cool-peco.git
cd cool-peco
sh ./install.sh

https://github.com/ryoppy/cool-peco

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment