Skip to content

Commit 578bffc

Browse files
authored
Make this loadable more easily by ZSH frameworks (#482)
Add repo's gitroot to `$PATH` so it can be loaded easily by ZSH frameworks. Signed-off-by: Joe Block <jpb@unixorn.net>
1 parent 18bafc6 commit 578bffc

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Vanilla `git diff` vs `git` and `diff-so-fancy`
1212

1313
Installation is as simple as cloning this repo and then putting the `diff-so-fancy` script in to your `$PATH`. The `lib/` directory will need to be kept relative to the core script.
1414

15+
If you are using a ZSH framework like [zgenom](https://github.com/jandamm/zgenom) or [oh-my-zsh](https://ohmyz.sh), refer to [ZSH framework install](zsh-frameworks.md) for detailed installation instructions.
16+
1517
`diff-so-fancy` is also available from the [NPM registry](https://www.npmjs.com/package/diff-so-fancy), [brew](https://formulae.brew.sh/formula/diff-so-fancy), as a package on [Nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/version-management/diff-so-fancy/default.nix), [Fedora](https://packages.fedoraproject.org/pkgs/diff-so-fancy/diff-so-fancy/), in the [Arch extra repo](https://archlinux.org/packages/extra/any/diff-so-fancy/), and as [ppa:aos for Debian/Ubuntu Linux](https://github.com/aos/dsf-debian).
1618

1719
Issues relating to packaging ('installation does not work', 'version is out of date', etc.) should be directed to those packages' own repositories/issue trackers where applicable.

diff-so-fancy.plugin.zsh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Add our plugin diretory to user's path
2+
#
3+
# See following web page for explanation of the line "ZERO=...":
4+
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
5+
6+
0="${ZERO:-${${0:#$ZSH_ARGZERO}:-${(%):-%N}}}"
7+
0="${${(M)0:#/*}:-$PWD/$0}"
8+
local diff_so_fancy_bin="${0:h}"
9+
10+
if [[ -z "${path[(r)${diff_so_fancy_bin}]}" ]]; then
11+
path+=( "${diff_so_fancy_bin}" )
12+
fi

pro-tips.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,27 @@ between files with `n`/`N` keys:
4545
diff = diff-so-fancy | less --tabs=4 -RFXS --pattern '^(Date|added|deleted|modified): '
4646
```
4747

48-
## Zsh plugin providing diff-so-fancy
48+
## Zsh plugin suppport for diff-so-fancy
4949

50-
Zsh plugin [zdharma-continuum/zsh-diff-so-fancy](https://github.com/zdharma-continuum/zsh-diff-so-fancy) has this
51-
project as a submodule, so installing the plugin installs `diff-so-fancy`. The plugin provides
52-
the subcommand `git dsf` out of the box. Installation with Zinit, Zplug, and Zgen:
50+
This project includes a `.plugin.zsh` file providing ZSH framework support, so you can use any framework that supports the ZSH plugin standard to install `diff-so-fancy` and add it to your `$PATH`. Installation with Zinit, Zplug, and Zgen:
5351

54-
```zsh
55-
# zinit
52+
### Install with zinit
53+
54+
```sh
5655
zinit ice lucid as"program" pick"bin/git-dsf"
57-
zinit load zdharma-continuum/zsh-diff-so-fancy
56+
zinit load so-fancy/diff-so-fancy
57+
```
58+
59+
### Install with zplug
60+
61+
```sh
62+
zplug "so-fancy/diff-so-fancy", as:command, use:bin/git-dsf
63+
```
5864

59-
# zplug
60-
zplug "zdharma-continuum/zsh-diff-so-fancy", as:command, use:bin/git-dsf
65+
# zgenom and others
6166

62-
# zgen and others
63-
zgen zdharma-continuum/zsh-diff-so-fancy
67+
```sh
68+
zgenom load so-fancy/diff-so-fancy
6469
```
6570

6671
## `hg` configuration

0 commit comments

Comments
 (0)