Re-import repository after cleanup from personal stuff (see description)
I've remove too dirty or specific stuff, so that i could put this
configuration on a public repo.
Here's a copy of the initial Mercurial changelog, FWIW...
* (2012-07-14) Mikael Berthe
Reorganize all scripts
* (2012-07-14) Mikael Berthe
Add a "tools" directory
* (2012-07-14) Mikael Berthe
Don't use ^X^C as a keybinding
* (2012-07-14) Mikael Berthe
Disable ... completion for now
* (2012-07-14) Mikael Berthe
Add rehash key binding
* (2012-07-14) Mikael Berthe
Add n fix a few key bindings
* (2012-07-14) Mikael Berthe
More cleanup
Remove zshrc_compinstall
Move personnal stuff to zshrc_local
* (2012-07-14) Mikael Berthe
New commands: ...*
Previous commands .. and ... have been renamed to ,, and ,,,
* (2012-07-14) Mikael Berthe
Add WATCHFMT, move REPORTTIME to zshenv
* (2012-07-14) Mikael Berthe
Add REPORTTIME
* (2012-07-13) Mikael Berthe
Add a few useful functions
Ideas borrowed from https://github.com/whiteinge/dotfiles/blob/master/.zshrc
* (2012-07-13) Mikael Berthe
Move aliases to a new file
* (2012-07-13) Mikael Berthe
Check for zshrc_local existence
* (2012-07-13) Mikael Berthe
Cleanup vcsinfo prompt
* (2012-07-12) Mikael Berthe
Colorize time in default color prompt as well
* (2012-07-12) Mikael Berthe
Prompt: colorize time
* (2012-07-12) Mikael Berthe
Add a copy of git-prompt.sh
* (2012-07-12) Mikael Berthe
Update prompt themes
Since we do not display the mode on the first line,
let's use this place for the date/time.
* (2012-07-12) Mikael Berthe
Update prompts / new showmode
* (2012-07-12) Mikael Berthe
More showmode cleanup, part2
* (2012-07-12) Mikael Berthe
Switch showmode to using RPROMPT, part1
* (2012-07-12) Mikael Berthe
Prompt: many improvements and fixes
* (2012-07-11) Mikael Berthe
More prompt code cleanup
* (2012-07-11) Mikael Berthe
More readable prompt generation
* (2012-07-11) Mikael Berthe
Dynamic path color
* (2012-07-11) Mikael Berthe
New prompt based on Zsh' vcs_info module
* (2012-07-10) Mikael Berthe
Add git info, add a light dev2 prompt
* (2012-07-10) Mikael Berthe
Dev prompt: Improve Mercurial repository detection
* (2012-07-08) Mikael Berthe
hg prompt: Change color of unapplied patches
* (2012-07-08) Mikael Berthe
Change Mercurial prompt format
* (2012-07-08) Mikael Berthe
Try to improve showmode support. Enable it for 256 color terms.
* (2012-07-08) Mikael Berthe
Fix interaction between showmode and the new "dev" prompt
When showmode is disabled (e.g. in screen), do not display the
mode in PS1.
* (2012-07-08) Mikael Berthe
Add development prompt (HG and minimal git support)
Can be set up from the shell command line with "prompt_set_dev".
* (2012-07-08) Mikael Berthe
Ignore Vim swap files
* (2009-12-22) Mikael Berthe
Slight update zlog{in,out}
* (2009-12-22) Mikael Berthe
Add zlogin
* (2009-12-22) Mikael Berthe
Update hgignore list
* (2009-12-22) Mikael Berthe
Initial import into Mercurial
#
# MiKael, 2012-07-10
# Sources:
# https://github.com/whiteinge/dotfiles/blob/master/.zsh_shouse_prompt
# http://git.rolinh.ch/index.php?p=dotfiles.git
# {{{
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git hg
zstyle ':vcs_info:(hg*|git*):*' get-revision true
zstyle ':vcs_info:(hg*|git*):*' check-for-changes true
zstyle ':vcs_info:hg*' formats "(%B%s%{${reset_color}%})[%i%u %b %m]" # rev+changes branch misc
#zstyle ':vcs_info:hg*' actionformats "(%s|%{$fg[red]%}%a%{$fg[white]%})[%i%u %b %m]"
zstyle ':vcs_info:hg*' actionformats "%{$fg[red]%}%a %{${reset_color}%}[%i%u %{$fg[blue]%}%b%{${reset_color}%}%m]"
zstyle ':vcs_info:hg*:*' get-bookmarks true
zstyle ':vcs_info:hg*:*' get-mq true
zstyle ':vcs_info:hg*:*' get-unapplied true
zstyle ':vcs_info:hg*:*' patch-format "mq(%g):%n/%c %p"
zstyle ':vcs_info:hg*:*' nopatch-format "mq(%g):%n/%c %p"
zstyle ':vcs_info:hg*:*' unstagedstr "%{$fg_bold[red]%}+%{${reset_color}%}"
zstyle ':vcs_info:hg*:*' hgrevformat "%r" # only show local rev.
zstyle ':vcs_info:hg*:*' branchformat "%b" # only show branch
zstyle ':vcs_info:git*' formats "(%B%s%{${reset_color}%}) %12.12i %c%u %b%m" # hash changes branch misc
#zstyle ':vcs_info:git*' formats "%c%u %b%m" # hash changes branch misc
zstyle ':vcs_info:git*' actionformats "(%s|%{$fg[white]%}%a) %12.12i %c%u %b%m"
zstyle ':vcs_info:git*:*' stagedstr "%{$fg[green]%}S%{${reset_color}%}"
zstyle ':vcs_info:git*:*' unstagedstr "%{$fg[red]%}U%{${reset_color}%}"
# zstyle ':vcs_info:hg:*:-all-' command fakehg
# zstyle ':vcs_info:*+*:*' debug true
zstyle ':vcs_info:hg*+set-hgrev-format:*' hooks hg-hashfallback
zstyle ':vcs_info:hg*+set-message:*' hooks mq-vcs
#zstyle ':vcs_info:git*+set-message:*' hooks git-st git-stash
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked git-st
### Dynamically set hgrevformat based on if the local rev is available
# We don't always know the local revision, e.g. if use-simple is set
# Truncate long hash to 12-chars but also allow for multiple parents
function +vi-hg-hashfallback() {
if [[ -z ${hook_com[localrev]} ]] ; then
local -a parents
parents=( ${(s:+:)hook_com[hash]} )
parents=( ${(@r:12:)parents} )
hook_com[rev-replace]="${(j:+:)parents}"
ret=1
fi
}
### Show when mq itself is under version control
function +vi-mq-vcs() {
# if [[ -d ${hook_com[base]}/.hg/patches/.hg ]]; then
# hook_com[hg-mqpatch-string]="mq:${hook_com[hg-mqpatch-string]}"
# fi
}
# Show remote ref name and number of commits ahead-of or behind
function +vi-git-st() {
local ahead behind remote
local -a gitstatus
# Are we on a remote-tracking branch?
remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} \
--symbolic-full-name --abbrev-ref 2>/dev/null)}
if [[ -n ${remote} ]] ; then
# for git prior to 1.7
# ahead=$(git rev-list origin/${hook_com[branch]}..HEAD | wc -l)
ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
(( $ahead )) && gitstatus+=( "%{$fg[green]%}+${ahead}%{${reset_color}%}" )
# for git prior to 1.7
# behind=$(git rev-list HEAD..origin/${hook_com[branch]} | wc -l)
behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
(( $behind )) && gitstatus+=( "%{$fg[red]%}-${behind}%{${reset_color}%}" )
#hook_com[branch]="${hook_com[branch]} [${remote} ${(j:/:)gitstatus}]"
hook_com[branch]="[%{$fg[blue]%}${hook_com[branch]}%{${reset_color}%}]"
fi
}
# Show count of stashed changes
function +vi-git-stash() {
local -a stashes
if [[ -s ${hook_com[base]}/.git/refs/stash ]] ; then
stashes=$(git stash list 2>/dev/null | wc -l)
#hook_com[misc]+=" (${stashes} stashed)"
hook_com[misc]+="(%{$fg[red]%}${stashes} %{${reset_color}%}stashed)"
fi
}
# Show count of untracked files
function +vi-git-untracked(){
if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \
git status --porcelain | grep '??' &> /dev/null ; then
# This will show the marker if there are any untracked files in repo.
# If instead you want to show the marker only if there are untracked
# files in $PWD, use:
#[[ -n $(git ls-files --others --exclude-standard) ]] ; then
local nb_untracked=$(git status --porcelain | grep "\? \?" | wc -l)
local nb_up=$(git status --porcelain | grep "M" | wc -l)
hook_com[staged]+="%{${reset_color}%}$nb_untracked%{$fg[red]%}N %{${reset_color}%}$nb_up"
fi
}
# }}}
# {{{ Prompts
setopt transient_rprompt
# Others prompts
PS2="%{$fg_no_bold[yellow]%}%_>%{${reset_color}%} "
PS3="%{$fg_no_bold[yellow]%}?#%{${reset_color}%} "
# }}}
# {{{ precmd()
function __precmd_vcsinfo {
vcs_info
local deco="%{${fg_no_bold[white]}%}"
if [[ -O "$PWD" ]]; then
local path_color="${fg_no_bold[magenta]}"
elif [[ -w "$PWD" ]]; then
local path_color="${fg_no_bold[blue]}"
else
local path_color="${fg_bold[red]}"
fi
if [[ $UID -eq 0 ]]; then
local user_color="${fg_bold[red]}"
else
local user_color="${fg_bold[default]}"
fi
local return_code="%(?..${deco}!%{${fg_bold[red]}%}%?${deco}! %{${reset_color}%})"
#local cwd="%{${path_color}%}%32<...<%~"
local cwd="%{${path_color}%}%~%{${reset_color}%}"
local sign="%(!.%{${fg_bold[red]}%}.${deco})%#"
PS1="${cwd}
${return_code}%D{%m%d %H:%M} [%B%n%b] %{%{$fg[red]%}%}%m%{${reset_color}%}${sign}%{${reset_color}%} "
# Prompt on the right, displayed when in a VCS repository
RPS1="${vcs_info_msg_0_}%{${reset_color}%}"
setopt prompt_subst
}
# }}}