Skip to content

Instantly share code, notes, and snippets.

@squallstar
Created March 21, 2019 11:01
Show Gist options
  • Save squallstar/c9a784a914ef96bd891033fe9bc4c927 to your computer and use it in GitHub Desktop.
Save squallstar/c9a784a914ef96bd891033fe9bc4c927 to your computer and use it in GitHub Desktop.
My .zshrc
export ZSH="/Users/nicholas/.oh-my-zsh"
ZSH_THEME="powerlevel9k/powerlevel9k"
plugins=(
git
)
source $ZSH/oh-my-zsh.sh
NPM_PACKAGES="${HOME}/.npm-packages"
PATH="$NPM_PACKAGES/bin:$PATH"
# Unset manpath so we can inherit from /etc/manpath via the `manpath` command
unset MANPATH # delete if you already modified MANPATH elsewhere in your config
export MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
export ANDROID_HOME=/Users/nicholas/Library/Android/sdk
export PATH=$ANDROID_SDK/emulator:$ANDROID_SDK/tools:$PATH
export PATH=$PATH:/Users/nicholas/Library/Android/sdk/platform-tools
export PATH=$PATH:/Users/nicholas/Library/Android/sdk/build-tools/28.0.2
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/
export PATH=$PATH:$(composer config -g home)/vendor/bin:$PATH
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL="zsh_wifi_signal"
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL_BACKGROUND="deepskyblue4"
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL_FOREGROUND="yellow"
zsh_wifi_signal(){
local output=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I)
local airport=$(echo $output | grep 'AirPort' | awk -F': ' '{print $2}')
if [ "$airport" = "Off" ]; then
local color='%F{yellow}'
echo -n "%{$color%}Wifi Off"
else
local ssid=$(echo $output | grep ' SSID' | awk -F': ' '{print $2}')
local speed=$(echo $output | grep 'lastTxRate' | awk -F': ' '{print $2}')
local color='%F{yellow}'
[[ $speed -gt 100 ]] && color='%F{green}'
[[ $speed -lt 50 ]] && color='%F{red}'
echo -n "%{$color%}$ssid $speed Mb/s%{%f%}" # removed char not in my PowerLine font
fi
}
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_wifi_signal dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs time)
# Aliases
alias ls='ls -G'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment