|
| 1 | +<h1> ZI + diff-so-fancy</h1> |
| 2 | + |
| 3 | +# Introduction |
| 4 | + |
| 5 | +The project [so-fancy/diff-so-fancy](https://github.com/so-fancy/diff-so-fancy) integration with ZI. |
| 6 | + |
| 7 | +With this [ZI](https://github.com/z-shell/zi) plugin, you simply add two lines to `.zshrc`: |
| 8 | + |
| 9 | +```zsh |
| 10 | +zi ice as"program" pick"bin/git-dsf" |
| 11 | +zi light z-shell/zsh-diff-so-fancy |
| 12 | +``` |
| 13 | + |
| 14 | +This will install `diff-so-fancy` on every account where you use Zshell, and automatically |
| 15 | +equip `git` with subcommand `dsf`. No need to use system package manager and to configure |
| 16 | +`git`. Of course, if you have the following standard line in your `.gitconfig`, it will |
| 17 | +still work normally: |
| 18 | + |
| 19 | +``` |
| 20 | +[core] |
| 21 | +pager = diff-so-fancy | less -FXRi |
| 22 | +``` |
| 23 | + |
| 24 | +(because this plugin adds `diff-so-fancy` to `$PATH`). |
| 25 | + |
| 26 | +Think about Puppet or Chef, i.e. about declarative approach to system configuration. |
| 27 | +In this case `.zshrc` is like a declarative setup guarding you will have `diff-so-fancy` |
| 28 | +on your accounts. |
| 29 | + |
| 30 | +# A Few Details |
| 31 | + |
| 32 | +[so-fancy/diff-so-fancy](https://github.com/so-fancy/diff-so-fancy) is cloned from |
| 33 | +Github as submodule. The plugin has `bin/git-dsf` script which adds subcommand `dsf` |
| 34 | +to git. That's basically everything needed: convenient way of installing (single Zsh |
| 35 | +plugin manager invocation), updating (Zsh plugin managers can easily update) and |
| 36 | +integrating with `git`. |
| 37 | + |
| 38 | +# Other plugin managers |
| 39 | + |
| 40 | +```zsh |
| 41 | +# Zplug |
| 42 | +zplug "z-shell/zsh-diff-so-fancy", as:command, use:"bin/" |
| 43 | + |
| 44 | +# Zgen |
| 45 | +zgen load z-shell/zsh-diff-so-fancy |
| 46 | +``` |
| 47 | + |
| 48 | +Without `as"program"`-like functionality the `.plugin.zsh` file picks up setup |
| 49 | +and simulates adding a command to system, so `Zgen` and other can work. |
0 commit comments