wfxr / forgit

:zzz: A utility tool powered by fzf for using git interactively.
MIT License
4.4k stars 137 forks source link

Preview command cannot be customized in command-specific options #185

Closed carlfriedrich closed 2 years ago

carlfriedrich commented 2 years ago

Check list

Environment info

Problem / Steps to reproduce

I would like to customize the preview command that it used in glo, so I thought I could easily add it to FORGIT_LOG_FZF_OPTS like described in the README. This does not work, however, because the --preview option is not included in FZF_DEFAULT_OPTS but a hard-coded argument to fzf:

https://github.com/wfxr/forgit/blob/e0d3552d4597f42c5c965daa5abd79845990f63a/forgit.plugin.zsh#L33

Is there a specific reason for this, or would it be possible to move the --preview="$cmd" argument into the opts between line 27 and 28?

https://github.com/wfxr/forgit/blob/e0d3552d4597f42c5c965daa5abd79845990f63a/forgit.plugin.zsh#L23-L33

That way I would be able to override the preview command in FORGIT_LOG_FZF_OPTS.

This also affects most other commands with their corresponding variables:

(BTW why doesn't forgit::cherry::pick have a corresponding variable?)

If nothing speaks against that, I could provide a pull request for it.

carlfriedrich commented 2 years ago

Since I don't see any drawbacks in making the proposed change, I just filed a PR #186 to fix this. Would love to see this merged.

carlfriedrich commented 2 years ago

Sorry, I accidentally closed this when I merged the change into my own fork. Reopen it to merge it here as well. @wfxr Let me know if you accept the change.

wfxr commented 2 years ago

@carlfriedrich Nice improvement, thanks for your contribution!