]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/branch/README.md
...
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / branch / README.md
1 # Branch plugin
2
3 This plugin displays the current Git or Mercurial branch, fast. If in a Mercurial repository,
4 also display the current bookmark, if present.
5
6 To use it, add `branch` to the plugins array in your zshrc file:
7
8 ```zsh
9 plugins=(... branch)
10 ```
11
12 ## Speed test
13
14 - `hg branch`:
15
16   ```console
17   $ time hg branch
18   0.11s user 0.14s system 70% cpu 0.355 total
19   ```
20
21 - branch plugin:
22
23   ```console
24   $ time zsh /tmp/branch_prompt_info_test.zsh
25   0.00s user 0.01s system 78% cpu 0.014 total
26   ```
27
28 ## Usage
29
30 Copy your theme to `$ZSH_CUSTOM/themes/` and modify it to add `$(branch_prompt_info)` in your prompt.
31 This example is for the `robbyrussell` theme:
32
33 ```diff
34 diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme
35 index 2fd5f2cd..9d89a464 100644
36 --- a/themes/robbyrussell.zsh-theme
37 +++ b/themes/robbyrussell.zsh-theme
38 @@ -1,5 +1,5 @@
39  PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
40 -PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
41 +PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(branch_prompt_info)'
42  
43  ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
44  ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
45 ```
46
47 ## Maintainer
48
49 Victor Torres (<vpaivatorres@gmail.com>)