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.

67 lines
1.8 KiB

3 years ago
  1. # `svn` plugin
  2. This plugin adds some utility functions to display additional information regarding your current
  3. svn repository. See https://subversion.apache.org/ for the full svn documentation.
  4. To use it, add `svn` to your plugins array:
  5. ```zsh
  6. plugins=(... svn)
  7. ```
  8. ## Functions
  9. | Command | Description |
  10. |:----------------------|:--------------------------------------------|
  11. | `svn_prompt_info` | Shows svn prompt in themes |
  12. | `in_svn` | Checks if we're in an svn repository |
  13. | `svn_get_repo_name` | Get repository name |
  14. | `svn_get_branch_name` | Get branch name (see [caveats](#caveats)) |
  15. | `svn_get_rev_nr` | Get revision number |
  16. | `svn_dirty` | Checks if there are changes in the svn repo |
  17. ## Caveats
  18. The plugin expects the first directory to be the current branch / tag / trunk. So it returns
  19. the first path element if you don't use branches.
  20. ## Usage on themes
  21. To use this in the `agnoster` theme follow these instructions:
  22. 1. Enable the svn plugin
  23. 2. Add the following lines to your `zshrc` file:
  24. ```shell
  25. prompt_svn() {
  26. local rev branch
  27. if in_svn; then
  28. rev=$(svn_get_rev_nr)
  29. branch=$(svn_get_branch_name)
  30. if [[ $(svn_dirty_choose_pwd 1 0) -eq 1 ]]; then
  31. prompt_segment yellow black
  32. echo -n "$rev@$branch"
  33. echo -n "±"
  34. else
  35. prompt_segment green black
  36. echo -n "$rev@$branch"
  37. fi
  38. fi
  39. }
  40. ```
  41. 3. Override the agnoster `build_prompt()` function:
  42. ```zsh
  43. build_prompt() {
  44. RETVAL=$?
  45. prompt_status
  46. prompt_context
  47. prompt_dir
  48. prompt_git
  49. prompt_svn
  50. prompt_end
  51. }
  52. ```