Closed LangLangBart closed 2 months ago
The suggestion here is to add an option similar to shellcmdflag
of Vim: https://vimdoc.sourceforge.net/htmldoc/options.html#'shellcmdflag'
Personally, I don't like having to set two environment variables (or options) to make it work. It doesn't feel much more ergonomic than writing a wrapper script. I'd prefer to add an option that looks like fzf --with-shell "$SHELL -c"
as commented in the previous pull request though it has it's own issue.
Sure, using --with-shell
is much clearer and simpler to write than using two environment variables.
It's important to mention in the documentation that, if this feature is implemented, one should not set
the flags to -ic
for the typical SHELL
(zsh
, …), as it usually ends badly. Below are some instances where
doing so has caused issues:
Checklist
man fzf
)Output of
fzf --version
0.50.0 (brew)
OS
Shell
Problem / Steps to reproduce
This report was created from a discussion on a discarded PR: #3726
Issue
fzf
currently executes commands with$SHELL
and a hardcoded-c
flag.https://github.com/junegunn/fzf/blob/f97d2754134607b24849fc4a2062dbfcaafddd6a/src/util/util_unix.go#L22-L29
If a user wants to use a different tool with a different flag to execute commands, they must prepend the desired command to each string, making proper quoting more cumbersome and leading to repetitive addition of the command.
Feature Proposal
Ability to change the flag that is passed to the
$SHELL
command.If the flag would be subject to change, then one would only need to write the string.
Here are a few examples of tools with their corresponding flags to illustrate the variety of flags that might be used:
jsc -e
: a short, single-letter option [^1]bun --print
: a long, word-based option [^2]osascript -l JavaScript -e
: multiple short, single-letter options and an argument [^3]Workaround
The maintainer provided a workaround [^4].
[^1]: JSC – WebKit [^2]: Bun — A fast all-in-one JavaScript runtime [^3]: JXA - JavaScript for Automation [^4]: PR #3726 (comment)