Skip to content

Instantly share code, notes, and snippets.

@GLMeece
Created September 5, 2019 22:07
Show Gist options
  • Save GLMeece/b89be4bb002918a94d6e5611a313457b to your computer and use it in GitHub Desktop.
Save GLMeece/b89be4bb002918a94d6e5611a313457b to your computer and use it in GitHub Desktop.
Z-shell Resource File PowerLevel9K Example
# zmodload zsh/zprof # <-- enable for shell profiling
# Note: for more options info, see:
# https://gist.github.com/geeknam/4423298046c4383d36a91c404ff049b1
# Autoload info:
# With the -U flag, alias expansion is suppressed when the function is loaded.
# -z mark the function to be autoloaded using the zsh style
autoload -Uz compinit
# Info on next block: https://gist.github.com/ctechols/ca1035271ad134841284
# Actual implementation here: https://carlosbecker.com/posts/speeding-up-zsh
if [ $(date +'%j') != $(stat -f '%Sm' -t '%j' ~/.zcompdump) ]; then
compinit
else
compinit -C
fi
# ~ ~ ~ ~ SET UP PATH ~ ~ ~ ~
orig_path=$PATH
sbin_pth=/usr/local/sbin
hbrw_python=/usr/local/opt/python/libexec/bin # I want 'python' to be Python 3!
vscode_app="/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
export PATH="$hbrw_python:$orig_path:$sbin_pth:$vscode_app"
# ~ ~ ~ ~ SET UP OH-MY-ZSH ~ ~ ~ ~
export ZSH=$HOME/.oh-my-zsh
# PowerLevel config stuff
# https://medium.com/the-code-review/make-your-terminal-more-colourful-and-productive-with-iterm2-and-zsh-11b91607b98c
# More here: https://github.com/Powerlevel9k/powerlevel9k/wiki/Stylizing-Your-Prompt
POWERLEVEL9K_VCS_GIT_ICON="uf296" # GitLab is my default Git repo icon
POWERLEVEL9K_SHORTEN_DIR_LENGTH=3
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_middle"
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status virtualenv time)
POWERLEVEL9K_MODE='nerdfont-complete'
ZSH_THEME="powerlevel9k/powerlevel9k"
COMPLETION_WAITING_DOTS="true"
# I've not found too many plug-ins I like
plugins=(
colored-man-pages
pipenv
virtualenvwrapper
)
# Gotta do this after plugins and PowerLevel stuff
source $ZSH/oh-my-zsh.sh
# Keeps Z-shell from complaining about R/W rights
if [[ $EUID -eq 0 ]]; then
ZSH_DISABLE_COMPFIX=true
fi
# Next line is for reference
# ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor)
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# ~ ~ ~ ~ LINK TO ALIASES ~ ~ ~ ~
# IMO, it's easier to manage aliases in a separate file
# Reference to Aliases file:
if [ -f ~/.aliases ]; then
. ~/.aliases
fi
# ~ ~ ~ ~ ENVIRONMENTAL VARIABLES ~ ~ ~ ~
export SSH_KEY_PATH="~/.ssh/rsa_id"
# Let's populate the environmental variables we want/need
# for local usage as well as VMs and Docker containers
envvarsdir="/.env/"
envvarsfile=secret_vars.ini
envvarspath=$HOME$envvarsdir$envvarsfile
# The following magic lets us export the key=value pairs
# as well as let things like Docker read it directly.
if [ -f "$envvarspath" ]
then
set -a
source $envvarspath
set +a
fi
# Prefer nano, so nano, nano, do-do!
export EDITOR=nano
export VISUAL="$EDITOR"
# ~ ~ ~ ~ PYTHON VIRTUAL ENV WRAPPER ~ ~ ~ ~
export WORKON_HOME=$HOME/.environments
source /usr/local/bin/virtualenvwrapper_lazy.sh
# iTerm2 shell integration stuff
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
# zprof # <-- enable for shell profiling - dumps upon new terminal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment