Skip to content

Instantly share code, notes, and snippets.

@aelkz
Created July 15, 2019 19:17
Show Gist options
  • Save aelkz/342f3ce7eb2e5f4fe4c864e6cc007641 to your computer and use it in GitHub Desktop.
Save aelkz/342f3ce7eb2e5f4fe4c864e6cc007641 to your computer and use it in GitHub Desktop.
zshrc (update 15072019)
MAVEN_PATH=/usr/local/devtools/apache-maven-3.5.4/bin/
OC_CLIENT=/usr/local/devtools/oc-cli-v3.11/
#OC_CLIENT=/usr/local/devtools/oc-cli-v4.1/
export PATH=$PATH:$MAVEN_PATH:$OC_CLIENT
# Path to your oh-my-zsh installation.
export ZSH="/Users/raphael/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
#ZSH_THEME="robbyrussell"
ZSH_THEME="powerlevel9k/powerlevel9k"
#ZSH_THEME="wild-cherry"
#ZSH_THEME="spaceship-prompt/spaceship"
POWERLEVEL9K_MODE='nerdfont-complete'
# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"
# which plugins do you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
)
source $ZSH/oh-my-zsh.sh
#source $(dirname $(gem which colorls))/tab_complete.sh
# User configuration
DEFAULT_USER="raphael"
alias zsh="vim ~/.zshrc"
alias down="cd ~/Downloads"
alias desktop="cd ~/Desktop"
alias redhat="cd ~/Documents/_redhat/"
alias ..="cd .."
alias ....="cd ../.."
alias look="sudo find . -name"
alias search="sudo grep --color -rnw ./ -e "
alias ports="sudo lsof -PiTCP -sTCP:LISTEN"
alias xclip="xclip -selection c"
alias speedtest="wget -O /dev/null cachefly.cachefly.net/100mb.test"
alias ls="colorls --group-directories-first -lA --sd"
alias ll="ls -la --block-size=MB"
alias operator-sdk="/usr/local/bin/operator-sdk"
alias javacounter="find . -type f -name '*.java' | wc -l"
alias classcounter="find . -type f -name '*.class' | wc -l"
alias markdowncounter="find . -type f -name '*.md' | wc -l"
# =========================
# POWERLEVEL CONFIGURATIONS
# =========================
POWERLEVEL9K_MODE='nerdfont-complete'
# Colorise the top Tabs of Iterm2 with the same color as background
# Just change the 18/26/33 wich are the rgb values
echo -ne "\033]6;1;bg;red;brightness;18\a"
echo -ne "\033]6;1;bg;green;brightness;26\a"
echo -ne "\033]6;1;bg;blue;brightness;33\a"
# Please only use this battery segment if you have material icons in your nerd font (or font)
# Otherwise, use the font awesome one in "User Segments"
prompt_zsh_battery_level() {
local percentage1=`pmset -g ps | sed -n 's/.*[[:blank:]]+*\(.*%\).*/\1/p'`
local percentage=`echo "${percentage1//\%}"`
local color='%F{red}'
local symbol="\uf00d"
pmset -g ps | grep "discharging" > /dev/null
if [ $? -eq 0 ]; then
local charging="false";
else
local charging="true";
fi
if [ $percentage -le 20 ]
then symbol='\uf579' ; color='%F{red}' ;
#10%
elif [ $percentage -gt 19 ] && [ $percentage -le 30 ]
then symbol="\uf57a" ; color='%F{red}' ;
#20%
elif [ $percentage -gt 29 ] && [ $percentage -le 40 ]
then symbol="\uf57b" ; color='%F{yellow}' ;
#35%
elif [ $percentage -gt 39 ] && [ $percentage -le 50 ]
then symbol="\uf57c" ; color='%F{yellow}' ;
#45%
elif [ $percentage -gt 49 ] && [ $percentage -le 60 ]
then symbol="\uf57d" ; color='%F{blue}' ;
#55%
elif [ $percentage -gt 59 ] && [ $percentage -le 70 ]
then symbol="\uf57e" ; color='%F{blue}' ;
#65%
elif [ $percentage -gt 69 ] && [ $percentage -le 80 ]
then symbol="\uf57f" ; color='%F{blue}' ;
#75%
elif [ $percentage -gt 79 ] && [ $percentage -le 90 ]
then symbol="\uf580" ; color='%F{blue}' ;
#85%
elif [ $percentage -gt 89 ] && [ $percentage -le 99 ]
then symbol="\uf581" ; color='%F{blue}' ;
#85%
elif [ $percentage -gt 98 ]
then symbol="\uf578" ; color='%F{green}' ;
#100%
fi
if [ $charging = "true" ];
then color='%F{green}'; if [ $percentage -gt 98 ]; then symbol='\uf584'; fi
fi
echo -n "%{$color%}$symbol" ;
}
zsh_internet_signal(){
local color
local symbol="\uf7ba"
if ifconfig en0 | grep inactive &> /dev/null; then
color="%F{red}"
else
color="%F{blue}"
fi
echo -n "%{$color%}$symbol "
}
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_RPROMPT_ON_NEWLINE=true
POWERLEVEL9K_SHORTEN_DIR_LENGTH=3
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_beginning"
POWERLEVEL9K_RVM_BACKGROUND="black"
POWERLEVEL9K_RVM_FOREGROUND="249"
POWERLEVEL9K_RVM_VISUAL_IDENTIFIER_COLOR="red"
POWERLEVEL9K_TIME_BACKGROUND="black"
POWERLEVEL9K_TIME_FOREGROUND="249"
POWERLEVEL9K_TIME_FORMAT="%D{%H:%M %d/%m/%y}"
POWERLEVEL9K_RVM_BACKGROUND="black"
POWERLEVEL9K_RVM_FOREGROUND="249"
POWERLEVEL9K_RVM_VISUAL_IDENTIFIER_COLOR="red"
POWERLEVEL9K_STATUS_VERBOSE=false
POWERLEVEL9K_VCS_CLEAN_FOREGROUND='black'
POWERLEVEL9K_VCS_CLEAN_BACKGROUND='green'
POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND='black'
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='yellow'
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='white'
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='black'
POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND='black'
POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND='blue'
POWERLEVEL9K_FOLDER_ICON=''
POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE=true
POWERLEVEL9K_STATUS_VERBOSE=false
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0
POWERLEVEL9K_VCS_UNTRACKED_ICON='\u25CF'
POWERLEVEL9K_VCS_UNSTAGED_ICON='\u00b1'
POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON='\u2193'
POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON='\u2191'
POWERLEVEL9K_VCS_COMMIT_ICON="\uf417"
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="%F{blue}\u256D\u2500%f"
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%F{blue}\u2570\uf460%f "
POWERLEVEL9K_CUSTOM_BATTERY_STATUS="prompt_zsh_battery_level"
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context battery custom_internet_signal custom_battery_status_joined ssh root_indicator dir dir_writable vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(command_execution_time status time ip)
HIST_STAMPS="mm/dd/yyyy"
DISABLE_UPDATE_PROMPT=true
DISABLE_MAGIC_FUNCTIONS=true
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
neofetch --memory_display bar --color_blocks off
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/usr/local/devtools/google-cloud-sdk/path.zsh.inc' ]; then . '/usr/local/devtools/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/usr/local/devtools/google-cloud-sdk/completion.zsh.inc' ]; then . '/usr/local/devtools/google-cloud-sdk/completion.zsh.inc'; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment