my xfce4 dotfiles
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.

49 lines
1.2 KiB

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