mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
this should not break the old way of putting git info in the prompt.
Also changed awesomepanda theme to use the new scm architecture.
for users:
this works the same as plugins: the scms variable is set in ~/.zshrc with a list of SCM for which info should be displayed in the prompt, as simple as that.
for theme developers:
instead of calling the git_prompt_info function, you can call the get_scm_prompt, which will display info for all the scms in the scms variable.
the following variables can be used in the old git-way:
ZSH_THEME_SCM_PROMPT_PREFIX: before everything but the scm's name (svn, git, ..)
ZSH_THEME_SCM_PROMPT_SUFFIX: after everything
ZSH_THEME_SCM_PROMPT_DIRTY: displayed when the repo is dirty
ZSH_THEME_SCM_PROMPT_CLEAN displated when the repo is clean
by default, the name of the scm (git, svn, ...) is not displayed before the scm info, but this can be changed by setting the ZSH_THEME_SCM_DISPLAY_NAME to 1.
for scm-plugin developers:
to make an scm plugin with the name 'foo':
add a script called 'foo.scm.zsh' in to the scm folder. this script has to contain two functions:
scm_in_foo_repo: checks wether we are in a foo repo, usually by checking if a .foo folder is present
scm_foo_prompt_info: returns the prompt which follows the rules outlined above (in the "for theme developers"-section)
55 lines
No EOL
1.3 KiB
Bash
55 lines
No EOL
1.3 KiB
Bash
# ls colors
|
|
autoload colors; colors;
|
|
export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
|
#export LS_COLORS
|
|
|
|
# Enable ls colors
|
|
if [ "$DISABLE_LS_COLORS" != "true" ]
|
|
then
|
|
# Find the option for using colors in ls, depending on the version: Linux or BSD
|
|
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
|
|
fi
|
|
|
|
#setopt no_beep
|
|
setopt auto_cd
|
|
setopt multios
|
|
setopt cdablevarS
|
|
|
|
if [[ x$WINDOW != x ]]
|
|
then
|
|
SCREEN_NO="%B$WINDOW%b "
|
|
else
|
|
SCREEN_NO=""
|
|
fi
|
|
|
|
# Apply theming defaults
|
|
PS1="%n@%m:%~%# "
|
|
|
|
# git theming default: Variables for theming the git info prompt
|
|
ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name
|
|
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
|
|
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
|
|
ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean
|
|
|
|
# Setup the prompt with pretty colors
|
|
setopt prompt_subst
|
|
|
|
|
|
#load scm prompt info
|
|
ZSH_THEME_SCM_DISPLAY_NAME=0
|
|
for scm in $scms; do
|
|
source $ZSH/scm/$scm.scm.zsh
|
|
done
|
|
|
|
|
|
|
|
function get_scm_prompt () {
|
|
for scm in $scms; do
|
|
if [ $("scm_in_"$scm"_repo") ]; then
|
|
echo `"scm_"$scm"_prompt_info"`
|
|
fi
|
|
done
|
|
}
|
|
|
|
# Load the theme
|
|
source "$ZSH/themes/$ZSH_THEME.zsh-theme" |