Skip to content

Instantly share code, notes, and snippets.

@tanner0101
Last active June 25, 2019 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanner0101/5b73eb2adda84545f27bfe8b5a091e11 to your computer and use it in GitHub Desktop.
Save tanner0101/5b73eb2adda84545f27bfe8b5a091e11 to your computer and use it in GitHub Desktop.
zsh profile
# echo current git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
}
# echo "*" if git status is unclean
parse_git_status() {
GIT_STATUS="$(git status 2>&1)"
if [[ $GIT_STATUS != *"clean"* ]] &&
[[ $GIT_STATUS != *"not a git repository"* ]];
then
echo "*"
else
echo ""
fi
}
# set custom zsh prompt, example:
# ~/dev/vapor/vapor master* $
PS1='%F{magenta}%~%f%F{cyan}$(parse_git_branch)%f$(parse_git_status) $ '
# enable prompt refreshing
setopt promptsubst
# set terminal title to current directory
precmd() {
echo -ne "\e]1;$(dirs)\a"
}
# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH
# Executes /bin/sh in a Swift docker container
_swift_linux() {
docker run -it -v $PWD:/root/code -w /root/code vapor/swift:5.0 /bin/sh
}
alias swift-linux='_swift_linux'
@tanner0101
Copy link
Author

Screen Shot 2019-06-25 at 5 04 29 PM

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