mirror of
https://github.com/bertptrs/vimconfig.git
synced 2025-12-25 20:40:32 +01:00
Rework prompt to have VCS information.
This commit is contained in:
@@ -194,19 +194,3 @@ SAVEHIST=$HISTSIZE
|
|||||||
|
|
||||||
setopt autocd # Automatically cd to dirs typed
|
setopt autocd # Automatically cd to dirs typed
|
||||||
setopt notify
|
setopt notify
|
||||||
|
|
||||||
############################
|
|
||||||
# Configure terminal title #
|
|
||||||
############################
|
|
||||||
precmd ()
|
|
||||||
{
|
|
||||||
print -Pn "\e]0;%n@%m: %2~\a"
|
|
||||||
}
|
|
||||||
|
|
||||||
preexec ()
|
|
||||||
{
|
|
||||||
if [ -n $1 ]; then
|
|
||||||
cmd=${1:0:20}
|
|
||||||
print -Pn "\e]0;$1\a"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,6 +3,21 @@
|
|||||||
# Allow color escape sequences to be available
|
# Allow color escape sequences to be available
|
||||||
autoload -U colors && colors
|
autoload -U colors && colors
|
||||||
|
|
||||||
|
# Initialize VCS prompt configuration
|
||||||
|
autoload -Uz vcs_info
|
||||||
|
|
||||||
|
zstyle ':vcs_info:*' enable git svn
|
||||||
|
zstyle ':vcs_info:*' check-for-changes true
|
||||||
|
zstyle ':vcs_info:*' check-for-staged-changes true
|
||||||
|
zstyle ':vcs_info:*' actionformats \
|
||||||
|
'%F{5}(%f%s@%r%F{5})%F{3} - %F{5}[%F{2}%u%b%c%F{3}|%F{1}%a%F{5}]%f'
|
||||||
|
zstyle ':vcs_info:*' formats \
|
||||||
|
'%F{5}(%f%s@%r%F{5})%F{3} - %F{5}[%F{2}%u%b%c%F{5}]%f'
|
||||||
|
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
|
||||||
|
zstyle ':vcs_info:*' unstagedstr '~'
|
||||||
|
zstyle ':vcs_info:*' stagedstr '±'
|
||||||
|
|
||||||
|
|
||||||
# Allow calling functions inside prompt
|
# Allow calling functions inside prompt
|
||||||
setopt PROMPT_SUBST
|
setopt PROMPT_SUBST
|
||||||
|
|
||||||
@@ -42,6 +57,7 @@ function prompt_ps1() {
|
|||||||
"$dir"
|
"$dir"
|
||||||
$'\n'
|
$'\n'
|
||||||
'$(prompt_handle_virtualenv)'
|
'$(prompt_handle_virtualenv)'
|
||||||
|
'${vcs_info_msg_0_:+${vcs_info_msg_0_}\n}'
|
||||||
"$prompt"
|
"$prompt"
|
||||||
)
|
)
|
||||||
echo "${(j::)ps1}"
|
echo "${(j::)ps1}"
|
||||||
@@ -58,6 +74,20 @@ function prompt_rprompt() {
|
|||||||
echo "${(j::)rprompt}"
|
echo "${(j::)rprompt}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function precmd () {
|
||||||
|
# Set window title to username@machine: pwd
|
||||||
|
print -Pn "\e]0;%n@%m: %2~\a"
|
||||||
|
# Load VCS info
|
||||||
|
vcs_info
|
||||||
|
}
|
||||||
|
|
||||||
|
function preexec () {
|
||||||
|
# Set window title to command about to be executed.
|
||||||
|
if [[ -n $1 ]]; then
|
||||||
|
print -Pn "\e]0;$1\a"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
PS1="$(prompt_ps1)"
|
PS1="$(prompt_ps1)"
|
||||||
RPROMPT="$(prompt_rprompt)"
|
RPROMPT="$(prompt_rprompt)"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user