Last active
April 25, 2025 12:38
-
-
Save milljm/cc326af08827d1e1f3cd8b209fa816f3 to your computer and use it in GitHub Desktop.
.zshrc profile multi-line, conda/git detection support. Add git diff detection
This file contains hidden or 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
################################# | |
export CLICOLOR=1 | |
export LSCOLORS=exfxcxdxbxegedabagacad | |
alias ll='ls -latrh' | |
alias l='ls -latrh' | |
setopt noautomenu | |
setopt nomenucomplete | |
setopt auto_cd | |
setopt PROMPT_SUBST | |
autoload -U colors && colors | |
# git branch function (stole this from ohmyzsh) | |
function git_current_branch() { | |
local ref | |
ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null) | |
local ret=$? | |
if [[ $ret != 0 ]]; then | |
[[ $ret == 128 ]] && return # no git repo. | |
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return | |
fi | |
CHANGES="$(git diff --stat 2>/dev/null)" | |
if [ -z "${CHANGES}" ]; then | |
echo "%F{239}%K{000}{%F{237}%K{000}branch:%F{208}%K{000}"${ref#refs/heads/}"%F{239}%K{000}}%{$reset_color%}" | |
else | |
echo "%F{239}%K{000}{%F{237}%K{000}branch:%F{208}%K{000}"${ref#refs/heads/}" %F{9}%K{000}+%F{10}%K{000}-%F{239}%K{000}}%{$reset_color%}" | |
fi | |
} | |
function conda_env() { | |
if [ -n "$CONDA_DEFAULT_ENV" ]; then | |
echo "%F{239}%K{000}{%F{237}%K{000}env:%F{208}%K{000}$CONDA_DEFAULT_ENV%F{239}%K{000}}%{$reset_color%}" | |
fi | |
} | |
function me_at() { | |
echo "%F{239}%K{000}[%F{34}%K{000}%n%{$reset_color%}@%F{94}%K{000}%m%F{239}%K{000}]%{$reset_color%}" | |
} | |
export PROMPT=' | |
$(me_at)$(conda_env)$(git_current_branch) | |
%F{239}%K{000}[%F{39}%K{000}%~%F{239}%K{000}] | |
%F{250}%K{000}$%{$reset_color%} ' | |
################################# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use PowerLevel10K instead!
I am just posting this for quick pretty prompts for the many machines I log into.