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>
Just like with the other shells, exit fish to, if called from a non-interactive
shell.
We cannot use `return`, as older versions of fish (namely < 3.4.0) did not
support to use `return` in `.`-scripts (this was only added with fish commit
3359e5d2e9bcbf19d1652636c8e448a6889302ae).
Unlike in POSIX, fish’s `exit` is however documented to no cause the calling
shell to exit when executed in a sourced script (see:
0f70b2c0d3/doc_src/cmds/exit.rst (L20)
)
Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
`find`’s `-path`-option is described to use shell patterns (i.e. POSIX’ pattern
matching notation).
In that, `.` is not a special character, thus escaping it shouldn’t be
necessary.
Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
Requires latest tmux built from source (e.g. brew install tmux --HEAD)
Examples:
# 50%/50% width and height on the center of the screen
fzf-tmux -p
# 80%/80%
fzf-tmux -p80%
# 80%/40%
fzf-tmux -p80%,40%
# Separate -w and -h
fzf-tmux -w80% -h40%
# 80%/40% at position (0, 0)
fzf-tmux -w80% -h40% -x0 -y0
You can configure key bindings and fuzzy completion to open in tmux
popup window like so:
FZF_TMUX_OPTS='-p 80%'
Perl was used to remove the trailing newline character, but fzf already
has --print0 to use null character as terminators, and fish read -z is
expecting null character as terminators. There is no reason to depend on
perl if --print0 is passed to fzf invocation.
$FISH_VERSION is dropped in 2.7, but every version has $version
- https://github.com/fish-shell/fish-shell/issues/4414
- fb8ae04f80
Comment from @faho in #1316:
Unfortunately, $FISH_VERSION was only ever a thing from fish 2.0 to fish 2.7.1.
All fish versions from the very beginning though used a variable called simply "$version" to store their version, so that is the one that should be used.
This also modifies <C-t> behaviour.
The longest file path in the input is used as root directory for `find`
command. The remainder of the input is passed to fzf's --query as a
initial search parameters.
If "." is given as the argument to begin <C-t> completion, the leading
"." is not correctly removed. In general, if user selects a fzf
completion, the current token should be "consumed".
CTRL-R binding used to start with --no-sort to list the matched commands
in chronological order. However, it has been a constant source of
confusion. Let's enable it by default from now on. The sorted result
shouldn't be too confusing as we use --tiebreak=index.
Replace the "temp file" workaround with the "read" function: it's
simpler and faster.
Use proper escaping, remove the custom function.
The "file" widget uses last token as root for the "find" command.
This replaces the equivalent of '**' completion in bash/zsh.
The "$dir" non-expanded variable can be used in FZF_CTRL_T_COMMAND to
set the root.
This seems like a bug of fish, but sometimes when you select an item
fish complains:
"insertion mode switches can not be used when not in insertion mode"
This only happens when using tmux pane. Injecting a dummy command
somehow fixes the issue.