Rationale: this way the resulting cd command that ends up in the shell
history can be reused to get to the same location regardless of
the current working directory.
Co-authored-by: LangLangBart <92653266+LangLangBart@users.noreply.github.com>
The environment variable get the value of the preview label, even if it
has been updated with an action. It can be useful to track the label of
the preview and be able to switch between previews using only one
binding.
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
This makes it possible to skip one of the above key bindings or
completions by setting a variable to an empty string. For example,
FZF_CTRL_T_COMMAND= FZF_ALT_C_COMMAND= \
eval "$(fzf --zsh)"
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
This simplifies the distribution, and the users are less likely to have
problems caused by using incompatible scripts and binaries.
# Set up fzf key bindings and fuzzy completion
eval "$(fzf --bash)"
# Set up fzf key bindings and fuzzy completion
eval "$(fzf --zsh)"
# Set up fzf key bindings
fzf --fish | source
In the current codebase, for the original completion settings, the
pieces of the codes to determine the variable name and to access the
stored data are scattered. In this patch, we define functions to
access these variables. Those functions will be used in a coming
patch.
* This patch also resolves an inconsistent escaping of "$cmd": $cmd is
escaped as ${...//[^A-Za-z0-9_]/_} in some places, but it is escaped
as ${...//[^A-Za-z0-9_=]/_} in some other places. The latter leaves
the character "=" in the command name, which causes an issue because
"=" cannot be a part of a variable name. For example, the following
test case produces an error message:
$ COMP_WORDBREAKS=${COMP_WORDBREAKS//=}
$ _test1() { COMPREPLY=(); }
$ complete -vF _test1 cmd.v=1.0
$ _fzf_setup_completion path cmd.v=1.0
$ cmd.v=1.0 [TAB]
bash: _fzf_orig_completion_cmd_v=1_0: invalid variable name
The behavior of leaving "=" was present from the beginning when
saving the original completion is introduced in commit 91401514, and
this does not seem to be a specific reasoning. In this patch, we
replace "=" as well as the other non-identifier characters.
* Note: In this patch, the variable REPLY is used to return values
from functions. This design is to make it useful with the value
substitutions, a new Bash feature of the next release 5.3, which is
taken from mksh.