From e15849c990edb16b9a617138b2cf31ee59a09a08 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Wed, 29 May 2019 09:32:17 +0300 Subject: [PATCH] Add documentation and align it with actual functionality Former-commit-id: 827d1e56a33801464ed4dd44bf64fa01e127671f --- README.md | 11 +++++++++++ forgit.plugin.zsh | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 852d1fc..5797600 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,17 @@ FORGIT_FZF_DEFAULT_OPTS=" --height '80%' " ``` + +You can also customize options fzf will use for each command individually: + +- `ga`: `FORGIT_ADD_FZF_OPTS` +- `glo`: `FORGIT_LOG_FZF_OPTS` +- `gi`: `FORGIT_IGNORE_FZF_OPTS` +- `gd`: `FORGIT_DIFF_FZF_OPTS` +- `gcf`: `FORGIT_CHECKOUT_FZF_OPTS` +- `gss`: `FORGIT_STASH_FZF_OPTS` +- `gclean`: `FORGIT_CLEAN_FZF_OPTS` + ## Optional - [`diff-so-fancy`](https://github.com/so-fancy/diff-so-fancy): Improve the `git diff` output. diff --git a/forgit.plugin.zsh b/forgit.plugin.zsh index 9a1a14b..30ea15f 100755 --- a/forgit.plugin.zsh +++ b/forgit.plugin.zsh @@ -62,7 +62,7 @@ forgit::restore() { local cmd files files="$(git ls-files --modified "$(git rev-parse --show-toplevel)"| forgit::fzf -m -0 --preview="$preview_cmd" | - "$FORGIT_RESTORE_FZF_OPTS")" + "$FORGIT_CHECKOUT_FZF_OPTS")" [[ -n "$files" ]] && echo "$files" |xargs -I{} git checkout {} && git status --short && return echo 'Nothing to restore.' } @@ -83,7 +83,7 @@ forgit::clean() { forgit::inside_work_tree || return 1 local files # Note: Postfix '/' in directory path should be removed. Otherwise the directory itself will not be removed. - files=$(git clean -xdfn "$@"| awk '{print $3}'| forgit::fzf -m -0 |sed 's#/$##') + files=$(git clean -xdfn "$@"| awk '{print $3}'| forgit::fzf -m -0 "$FORGIT_CLEAN_FZF_OPTS" |sed 's#/$##') [[ -n "$files" ]] && echo "$files" |xargs -I{} git clean -xdf {} echo 'Nothing to clean.' }