You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.8 KiB
59 lines
1.8 KiB
![]()
13 years ago
|
#
|
||
|
# A simple theme that displays only relevant information.
|
||
|
#
|
||
|
# Authors:
|
||
|
# Julien Nicoulaud <julien.nicoulaud@gmail.com>
|
||
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||
|
#
|
||
|
# Features:
|
||
|
# - One line.
|
||
|
# - VCS information in the right prompt.
|
||
|
# - Only shows the path on the left prompt by default.
|
||
|
# - Crops the path to a defined length and only shows the path relative to
|
||
![]()
13 years ago
|
# the current VCS repository root.
|
||
![]()
13 years ago
|
# - Uses a different color depending on if the last command succeeded/failed.
|
||
|
# - Shows user@hostname if connected through SSH.
|
||
|
# - Shows if logged in as root or not.
|
||
|
#
|
||
![]()
13 years ago
|
|
||
![]()
13 years ago
|
function prompt_nicoulaj_precmd {
|
||
![]()
13 years ago
|
vcs_info
|
||
|
}
|
||
|
|
||
![]()
13 years ago
|
function prompt_nicoulaj_setup {
|
||
![]()
13 years ago
|
setopt LOCAL_OPTIONS
|
||
|
unsetopt XTRACE KSH_ARRAYS
|
||
|
prompt_opts=(cr percent subst)
|
||
![]()
13 years ago
|
|
||
|
# Load required modules.
|
||
|
autoload -Uz add-zsh-hook
|
||
|
autoload -Uz vcs_info
|
||
|
|
||
|
# Add hook for calling vcs_info before each command.
|
||
![]()
13 years ago
|
add-zsh-hook precmd prompt_nicoulaj_precmd
|
||
![]()
13 years ago
|
|
||
|
# Customizable parameters.
|
||
|
local max_path_chars=30
|
||
|
local user_char='❯'
|
||
|
local root_char='❯❯❯'
|
||
|
local success_color='%F{071}'
|
||
|
local failure_color='%F{124}'
|
||
|
local vcs_info_color='%F{242}'
|
||
|
|
||
|
# Set vcs_info parameters.
|
||
|
zstyle ':vcs_info:*' enable bzr git hg svn
|
||
|
zstyle ':vcs_info:*:*' check-for-changes true # Can be slow on big repos.
|
||
|
zstyle ':vcs_info:*:*' unstagedstr '!'
|
||
|
zstyle ':vcs_info:*:*' stagedstr '+'
|
||
|
zstyle ':vcs_info:*:*' actionformats "%S" "%r/%s/%b %u%c (%a)"
|
||
|
zstyle ':vcs_info:*:*' formats "%S" "%r/%s/%b %u%c"
|
||
|
zstyle ':vcs_info:*:*' nvcsformats "%~" ""
|
||
|
|
||
|
# Define prompts.
|
||
|
PROMPT="%(?.${success_color}.${failure_color})${SSH_TTY:+[%n@%m]}%B%${max_path_chars}<...<"'${vcs_info_msg_0_%%.}'"%<<%(!.${root_char}.${user_char})%b%f "
|
||
|
RPROMPT="${vcs_info_color}"'${vcs_info_msg_1_}'"%f"
|
||
|
}
|
||
|
|
||
|
prompt_nicoulaj_setup "$@"
|
||
|
|