Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/z-shell/zsh-diff-so-fancy
⚙️ The diff-so-fancy for Zsh
https://github.com/z-shell/zsh-diff-so-fancy
awesome-zsh-plugins diff diff-utils git-diff git-difftool zsh zsh-plugin
Last synced: about 3 hours ago
JSON representation
⚙️ The diff-so-fancy for Zsh
- Host: GitHub
- URL: https://github.com/z-shell/zsh-diff-so-fancy
- Owner: z-shell
- License: gpl-3.0
- Created: 2021-11-02T12:26:20.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-16T11:51:30.000Z (4 months ago)
- Last Synced: 2024-07-16T14:35:35.865Z (4 months ago)
- Topics: awesome-zsh-plugins, diff, diff-utils, git-diff, git-difftool, zsh, zsh-plugin
- Language: Shell
- Homepage: https://wiki.zshell.dev/ecosystem/plugins/diff-so-fancy
- Size: 3.75 MB
- Stars: 19
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: docs/README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
❮ Zi ❯ Plugin - zsh-diff-so-fancy
## The `diff-so-fancy`
The [so-fancy/diff-so-fancy](https://github.com/so-fancy/diff-so-fancy) as Github submodule.
The plugin has `bin/git-dsf` script which adds subcommand `dsf` to `git`, and `bin/fancy-diff` to pipe the `diff` output to diff-so-fancy.
## Manual configuration
```shell
diff-so-fancy --colors # View the commands to set the recommended colors
diff-so-fancy --set-defaults # Configure git-diff to use diff-so-fancy and suggested colors
diff-so-fancy --patch # Use diff-so-fancy in patch mode (interoperable with `git add --patch`)
``````shell
# Configure git to use d-s-f for *all* diff operations
git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX"
``````shell
# Configure git to use d-s-f for `git add --patch`
git config --global interactive.diffFilter "diff-so-fancy --patch"
```### Options
#### markEmptyLines
Should the first block of an empty line be colored. (Default: true)
```shell
git config --bool --global diff-so-fancy.markEmptyLines false
```#### changeHunkIndicators
Simplify git header chunks to a more human readable format. (Default: true)
```shell
git config --bool --global diff-so-fancy.changeHunkIndicators false
```#### stripLeadingSymbols
Should the pesky `+` or `-` at line-start be removed. (Default: true)
```shell
git config --bool --global diff-so-fancy.stripLeadingSymbols false
```#### useUnicodeRuler
By default, the separator for the file header uses Unicode line-drawing characters. If this is causing output errors on your terminal, set this to `false` to use ASCII characters instead. (Default: true)
```shell
git config --bool --global diff-so-fancy.useUnicodeRuler false
```#### rulerWidth
By default, the separator for the file header spans the full width of the terminal. Use this setting to set the width of the file header manually.
```shell
git config --global diff-so-fancy.rulerWidth 47 # git log's commit header width
```## Install with [Zi](https://github.com/z-shell/zi)
The project [so-fancy/diff-so-fancy](https://github.com/so-fancy/diff-so-fancy) integration with Zi.
Simply add two lines to `.zshrc`:
Using [bin-gem-node](https://wiki.zshell.dev/ecosystem/annexes/bin-gem-node) annex (recommended):
```shell
zi ice as'null' sbin'bin/*'
zi light z-shell/zsh-diff-so-fancy
```Default:
```shell
zi ice as'program' pick'bin/*'
zi light z-shell/zsh-diff-so-fancy
```This will add `diff-so-fancy`, `fancy-diff`, `git-dsf` to `$PATH` and automatically equip `git` with subcommand `dsf`.
**No need to use the system package manager or manually configure** `git`, however, if you have the following standard line in your `.gitconfig`, it will still work as expected:
```ini
[core]
pager = diff-so-fancy | less --tabs=4 -RFX
[interactive]
diffFilter = diff-so-fancy --patch
```## Other plugin managers
### Zplug
```shell
zplug "z-shell/zsh-diff-so-fancy", as:command, use:"bin/"
```### Zgen
```shell
zgen load z-shell/zsh-diff-so-fancy
```Without `as"program"`-like functionality the `.plugin.zsh` file picks up setup
and simulates adding a command to the system, so `Zgen` and others can work.