Skip to content

Instantly share code, notes, and snippets.

@doole
Created June 24, 2015 09:47
Show Gist options
  • Save doole/5d4a0828e6c935634f94 to your computer and use it in GitHub Desktop.
Save doole/5d4a0828e6c935634f94 to your computer and use it in GitHub Desktop.
Hg prompt in ZSH

Hg prompt in ZSH

Install mercurial with homebrew.

brew install mercurial

Get hg-prompt from Bitbucket.

hg clone http://bitbucket.org/sjl/hg-prompt/ ~/src

Update extensions section in ~/.hgrc

[extensions]
  prompt = ~/src/hg-prompt/prompt.py

Add mercurial plugin to the list of your zsh plugins ~/.zshrc

plugins=(git mercurial osx brew ruby rails)

Add the following after source $ZSH/oh-my-zsh.sh or update your theme file ~/.oh-my-zsh/themes/%THEME.zsh-theme

function hg_prompt_info {
  hg prompt --angle-brackets "\
<%{$fg_bold[blue]%}hg:(%{$fg_bold[red]%}<branch>><:<tags|, >%{$fg_bold[blue]%})>\
%{$fg[yellow]%}<status|modified|unknown><update>\
<patches: <patches|join( → )>>%{$reset_color%}" 2>/dev/null
}

PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment