Created
April 6, 2020 14:58
-
-
Save emilk/34f7e20660cb707e6f5ad241e74cbf8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------- | |
# Shell Prompt | |
#------------------------------------------------------------- | |
if [[ "${DISPLAY%%:0*}" != "" ]]; then | |
HILIT=${red} # remote machine: prompt will be partly red | |
else | |
HILIT=${cyan} # local machine: prompt will be partly cyan | |
fi | |
# --> Replace instances of \W with \w in prompt functions below | |
#+ --> to get display of full path name. | |
function fastprompt() | |
{ | |
unset PROMPT_COMMAND | |
case $TERM in | |
*term | rxvt ) | |
PS1="${HILIT}[\h]$NC \w > \[\033]0;\${TERM} [\u@\h] \w\007\]" ;; | |
linux ) | |
PS1="${HILIT}[\h]$NC \w > " ;; | |
*) | |
PS1="[\h] \w > " ;; | |
esac | |
} | |
_powerprompt() | |
{ | |
LOAD=$(uptime|sed -e "s/.*: \([^,]*\).*/\1/" -e "s/ //g") | |
} | |
function powerprompt() | |
{ | |
PROMPT_COMMAND=_powerprompt | |
case $TERM in | |
*term | rxvt ) | |
PS1="${HILIT}[\A - \$LOAD]$NC\n[\u@\h \#] \w > \ | |
\[\033]0;\${TERM} [\u@\h] \w\007\]" ;; | |
linux ) | |
PS1="${HILIT}[\A - \$LOAD]$NC\n[\u@\h \#] \w > " ;; | |
* ) | |
PS1="[\A - \$LOAD]\n[\u@\h \#] \w > " ;; | |
esac | |
} | |
function pathprompt() | |
{ | |
unset PROMPT_COMMAND | |
PS1="\w > " | |
} | |
#powerprompt # This is the default prompt -- might be slow. | |
# If too slow, use fastprompt instead. ... | |
#fastprompt | |
pathprompt | |
#################################### | |
# stderred - makes stderr red: | |
# export DYLD_INSERT_LIBRARIES="/Users/emilk/code/src/stderred/build/libstderred.dylib${DYLD_INSERT_LIBRARIES:+:$DYLD_INSERT_LIBRARIES}" | |
#################################################################### | |
alias texturetool="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool" | |
alias dot=open | |
if [ -f ~/.git-completion.bash ]; then | |
. ~/.git-completion.bash | |
fi | |
export LC_ALL=en_US.UTF-8 | |
export LANG=en_US.UTF-8 | |
alias updatedb="/usr/libexec/locate.updatedb" | |
# ----------------------------------------------------------------------------------- | |
# https://github.com/nvbn/thefuck | |
# eval "$(thefuck --alias)" | |
# ----------------------------------------------------------------------------------- | |
export PATH="/Users/emilk/bin:$PATH" | |
# ----------------------------------------------------------------------------------- | |
export GOPATH="/Users/emilk/go" | |
export PATH="/Users/emilk/go/bin:$PATH" | |
# ----------------------------------------------------------------------------------- | |
# ccache: | |
export PATH="/usr/local/opt/ccache/libexec:$PATH" | |
# ----------------------------------------------------------------------------------- | |
# Git branch name in prompt: | |
# https://mfitzp.io/article/add-git-branch-name-to-terminal-prompt-mac/ | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
export PS1="\w\[\033[32m\]\$(parse_git_branch)\[\033[00m\] > " | |
export PATH="$HOME/.cargo/bin:$PATH" | |
# export RUST_BACKTRACE=full | |
# export EDITOR="subl" | |
# ----------------------------------------------------------------------------------- | |
# fzf - A command-line fuzzy finder | |
[ -f ~/.fzf.bash ] && source ~/.fzf.bash | |
# Open VS Code from terminal using `code`. | |
code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment