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