Skip to content

Instantly share code, notes, and snippets.

@DEKHTIARJonathan
Last active March 5, 2019 10:24
Show Gist options
  • Save DEKHTIARJonathan/e7caf1cdd6773df7d0b59ac4414ffb46 to your computer and use it in GitHub Desktop.
Save DEKHTIARJonathan/e7caf1cdd6773df7d0b59ac4414ffb46 to your computer and use it in GitHub Desktop.
Linux ZSH Config
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin directories
PATH="$HOME/bin:$HOME/.local/bin:/usr/local/cuda/bin/:$PATH"
alias ls="colorls"
alias ll="ls -al"
alias ip="ip -c"
alias nvidia="watch -n 0.3 nvidia-smi"
alias dbcluster="ssh jdekhtiar@dbcluster"
alias dckimg_update='docker images --format "{{.Repository}}:{{.Tag}}" | grep -v "<none>" | uniq | sort | xargs -L1 docker pull'
alias dck_clean='docker container prune && docker image prune'
alias git_reset='git reset HEAD --hard'
alias rrsync='rsync --ignore-existing -h -v -r -P'
alias scale_dockicons='dconf write /org/compiz/profiles/unity/plugins/unityshell/icon-size 32'
# _____ _
# |__ /___| |__ _ __ ___
# / // __| '_ \| '__/ __|
# / /_\__ \ | | | | | (__
# /____|___/_| |_|_| \___|
export ZSH="$HOME/.oh-my-zsh"
export TERM="xterm-256color"
# Syntax highlighting and tab completion
source ~/.oh-my-zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
autoload -Uz compinit
# Coloured man pages using less as pager
man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;36m") \
man "$@"
}
# Show OS info when opening a new terminal
neofetch
# Font mode for powerlevel9k
POWERLEVEL9K_MODE="nerdfont-complete"
# Set name of the theme to load.
ZSH_THEME="powerlevel9k/powerlevel9k"
# Prompt settings
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_RPROMPT_ON_NEWLINE=true
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="%K{white}%k"
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%K{green}%F{black} \uf155 %f%F{green}%k\ue0b0%f "
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status virtualenv root_indicator background_jobs history time)
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Separators
POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR=$'\ue0b0'
POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR=$'\ue0b1'
POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR=$'\ue0b2'
POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR=$'\ue0b7'
# Dir colours
POWERLEVEL9K_DIR_HOME_BACKGROUND='black'
POWERLEVEL9K_DIR_HOME_FOREGROUND='white'
POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND='black'
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND='white'
POWERLEVEL9K_DIR_DEFAULT_BACKGROUND='yellow'
POWERLEVEL9K_DIR_DEFAULT_FOREGROUND='black'
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_from_right"
# OS segment
POWERLEVEL9K_OS_ICON_BACKGROUND='black'
POWERLEVEL9K_LINUX_ICON='%F{cyan} \uf303 %F{white} arch %F{cyan}linux%f'
# VCS icons
POWERLEVEL9K_VCS_GIT_ICON=$'\uf1d2 '
POWERLEVEL9K_VCS_GIT_GITHUB_ICON=$'\uf113 '
POWERLEVEL9K_VCS_GIT_GITLAB_ICON=$'\uf296 '
POWERLEVEL9K_VCS_BRANCH_ICON=$''
POWERLEVEL9K_VCS_STAGED_ICON=$'\uf055'
POWERLEVEL9K_VCS_UNSTAGED_ICON=$'\uf421'
POWERLEVEL9K_VCS_UNTRACKED_ICON=$'\uf00d'
POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=$'\uf0ab '
POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=$'\uf0aa '
# VCS colours
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='blue'
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='black'
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='green'
POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND='black'
POWERLEVEL9K_VCS_CLEAN_BACKGROUND='green'
POWERLEVEL9K_VCS_CLEAN_FOREGROUND='black'
# VCS CONFIG
POWERLEVEL9K_SHOW_CHANGESET=false
# Status
POWERLEVEL9K_OK_ICON=$'\uf164'
POWERLEVEL9K_FAIL_ICON=$'\uf165'
POWERLEVEL9K_CARRIAGE_RETURN_ICON=$'\uf165'
# Battery
POWERLEVEL9K_BATTERY_LOW_FOREGROUND='red'
POWERLEVEL9K_BATTERY_CHARGING_FOREGROUND='blue'
POWERLEVEL9K_BATTERY_CHARGED_FOREGROUND='green'
POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND='blue'
POWERLEVEL9K_BATTERY_VERBOSE=true
# User with skull
user_with_skull() {
echo -n "\ufb8a $(whoami)"
}
POWERLEVEL9K_CUSTOM_USER="user_with_skull"
# Command auto-correction.
ENABLE_CORRECTION="false"
# Command execution time stamp shown in the history command output.
HIST_STAMPS="dd/mm/yyyy"
# Plugins to load
plugins=(
git
virtualenv
)
source $ZSH/oh-my-zsh.sh
export VIRTUAL_ENV_DISABLE_PROMPT=
[[ -e ~/.profile ]] && emulate sh -c 'source ~/.profile'
# For Ubuntu <= 16.10
sudo add-apt-repository ppa:dawidd0811/neofetch
# ZSH Prompt Header
sudo apt update
sudo apt install neofetch
# Color LS
sudo apt install ruby-full
sudo gem install colorls
# Syntax Highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/plugins/zsh-syntax-highlighting
# Install PowerFonts
pip install --user powerline-status
git clone https://github.com/ryanoasis/nerd-fonts ~/.oh-my-zsh/fonts/nerd-fonts
~/.oh-my-zsh/fonts/nerd-fonts/install.sh
# Install Theme
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment