summaryrefslogtreecommitdiff
path: root/shell/completion.zsh
AgeCommit message (Collapse)Author
2025-09-24Apply shfmt to bash script files (make fmt)Junegunn Choi
2025-09-24make lint: Perform bash script lintingJunegunn Choi
2025-07-25fix(shell): check for mawk existence before version check (#4468)LangLangBart
close #4463
2025-06-09[bash,zsh] Skip comments in ~/.ssh/configKoichi Murase
For the line "Host host1 # this is a comment", the current implementation generates words in an inline comment as hostnames. This patch removes the comment before generating the hostname.
2025-06-09[bash,zsh] Support "=" after "Hostname" and "Host" in ~/.ssh/configKoichi Murase
In ~/.ssh/config, "=" can also be used as a separator between the field name and the value. The current master does not properly handle this and generate a hostname "=" or one starting with "=". This patch correctly handles it.
2025-06-09[bash,zsh] Remove redundant filtering-out of comment/blank linesKoichi Murase
Comments are anyway removed in the subsequent call to `sub(/#.*/, "")`, and it becomes a blank line. Blank lines do not have fields, so they are ignored in the next for-loop.
2025-06-09[bash,zsh] Correctly exclude the hostname "0.0.0.0"Koichi Murase
In the current implementation, any hostnames in /etc/hosts containing "0.0.0.0" as a part (such as "110.0.0.0" would be excluded. "0.0.0.0" should be checked by the exact match.
2025-06-09[bash,zsh] Do not end the hostname analysis on "]" in ~/.ssh/known_hostsKoichi Murase
An entry of the form `[example.com]:port,192.168.0.1 ...` in ~/.ssh/known_hosts are not properly processed. The current implementation gives up the matching on the first occurrence of `]`, the subsequent 192.168.0.1 would not be extracted. This patch continues the analysis and removes "]" together with "[". This patch also removes the ":port" part from the hostnames in ~/.ssh/known_hosts. One cannot use the form "hostname:port" in the arguments to the ssh command anyway.
2025-06-09[bash,zsh] Process hostnames with uppercase letters in known_hostsKoichi Murase
2025-06-08[bash,zsh] Separate common functions into "shell/common.sh"Koichi Murase
2025-06-08[bash,zsh] Work around mawk 1.3.3-20090705 not supporting the POSIX bracketsKoichi Murase
2025-06-08[bash,zsh] Work around Solaris awk, which is non-standardKoichi Murase
Solaris awk at /usr/bin/awk is meant for backward compatibility with an ancient implementation of 1977 awk in the original UNIX. It lacks many features of POSIX awk. To use a standard-conforming version in Solaris, one needs to explicitly use /usr/xpg4/bin/awk.
2025-06-08[bash,zsh] Work around a quirk of macOS awkKoichi Murase
macOS awk is a variant of nawk, but it contains a unique patch for the UTF-8 support. However, this patch causes the problem. If the input contains any non-UTF-8 data, macOS awk stops processing and does not do anything, instead of ignoring the unrecognized data and continue the processing. However, the contents of the ssh configuration and /etc/hosts is not under the control of fzf, so we cannot fix the input when those files contain non-UTF-8 data. To work around this behavior, one can set the locale to LC_ALL=C to treat the input data with the plain 8-bit encoding.
2025-06-05[bash,zsh] Reduce the number of fork & execKoichi Murase
2025-06-05[zsh] Set shell options for pathname expansion "~/.ssh/config.d/*"Koichi Murase
This applies the same changes as commit 0a06fd6f for Bash (GitHub PR
2025-02-20[zsh/completion] don't unescape FZF_DEFAULT_OPTS (#4262)Steve Williams
2025-01-28Enhance --min-height option to take number followed by +Junegunn Choi
2025-01-27[completion] Replace 'tr' with built-in string substitutionJunegunn Choi
2025-01-27Enhance click-header eventJunegunn Choi
* Expose the name of the mouse action as $FZF_KEY * Trigger click-header on mouse up * Enhanced clickable header for `kill` completion
2025-01-26[completion] Make kill completion header clickableJunegunn Choi
2024-12-03chore: completion test command sequence (#4115)LangLangBart
cleanup zsh global scope
2024-11-14fix(zsh): handle backtick trigger edge case (#4090)LangLangBart
2024-11-12Fix zsh $+name syntax does not work with setopt ksh_arrays (#4084)林千里
2024-11-10Enhance command extraction in zsh completion (#4082)LangLangBart
Fix #1992
2024-08-07fix: Add fallback for cygwin ps (#3955)Eduardo D Sanchez
2024-07-06[completion] Use --wrap option in process completionJunegunn Choi
And remove the short preview window for showing the whole command. Because it is important to be able to see the whole command before deciding to kill it.
2024-07-05[zsh] Fix backslash escaping (#3909)Junegunn Choi
Fix #3859 To test: FZF_CTRL_T_COMMAND="echo -E 'foo\bar\baz'; echo -E 'hello\world'" _fzf_compgen_path() { eval $FZF_CTRL_T_COMMAND } source shell/key-bindings.zsh source shell/completion.zsh
2024-06-28[zsh] Fix completion error on openSUSE TumbleweedJunegunn Choi
Fix suggested by @LangLangBart Fix #3890
2024-06-19Remove comment in command substitution (#3875)Hexin
2024-06-13chore(shell): Separate declaration and assignment for zsh legacy versions ↵LangLangBart
(#3856)
2024-05-07[shell] Add $FZF_COMPLETION_{DIR,PATH}_OPTSJunegunn Choi
To allow separately overriding 'walker' options. Close #3778
2024-04-27[completion] Add undocumented bash variables for completion commandsJunegunn Choi
And allow empty FZF_COMPLETION_DIR_COMMANDS
2024-04-19Respect $FZF_DEFAULT_OPTS_FILE in key bindings and completion (#3742)Junegunn Choi
Fix #3740
2024-04-17fix: Move 'emulate' command outside interactive check (#3736)LangLangBart
2024-04-10[shell] Revert interactiveness checks for evalJunegunn Choi
So that there's no error even when the scripts are mistakenly evaluated in non-interactive sessions. bash -c 'eval "$(fzf --bash)"; echo done' zsh -c 'eval "$(fzf --zsh)"; echo done' * https://github.com/junegunn/fzf/pull/3675#issuecomment-2044860901 * https://github.com/junegunn/fzf/commit/f103aa4753b435f8f45c5130323effeb75583c15
2024-03-13Add walker options and replace 'find' with the built-in walker (#3649)Junegunn Choi
2023-10-29[completion] Handle all hostaliases in /etc/hosts (#3495)akdevservices
* Fix #3488 * Handle inline comments in hosts file
2023-10-14[zsh] Fix 'emulate: unknown argument -o' error on old zsh (#3465)LangLangBart
Fix #2094
2023-10-12[shell] make `__fzf_list_hosts()` definable by the userChristoph Anton Mitterer
Just like it’s already done for `_fzf_compgen_path()` and `_fzf_compgen_dir()` allow a user to easily define his own version of `__fzf_list_hosts()`. Also add some documentation on the expected “interface” of such custom function. Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2023-10-12[shell] move username prefixing code where neededChristoph Anton Mitterer
`__fzf_list_hosts()` seems like a function a user may want to override with some custom code. For that reason it should be kept as simple as possible, that is printing only hostnames, one per line, optionally in some sorting. The handling of adding a `username@` (which is then the same for each line), if any, would unnecessarily complicate that for people who want to override the function. Therefore this commit moves that to the places where it's actually used (as of now only `_fzf_complete_ssh()`). This also saves any such handling for `_fzf_host_completion()`, where this isn’t needed at all. Right now it comes at a cost, namely an extra invocation of `awk` in the `_fzf_complete_ssh()`-case. However, it should be easily possible to improve `__fzf_list_hosts()` to no longer need the final `awk` in the pipeline there. Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2023-10-12[shell] don’t print error on non-existent SSH filesChristoph Anton Mitterer
Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2023-10-09Improve interactiveness checks (#3449)Christoph Anton Mitterer
* [bash] return instead of not executing an if-block, when non-interactive This should keep the code more readable, be less error prone (accidentally doing something outside the if-block and aligns the code with what’s already done for zsh. `0` is returned, because it shall not be considered an error when the script is (accidentally) sourced from a non-interactive shell. If executed as a script (rather than sourced), the results are not specified by POSIX but depend on the shell, with bash giving an error in that case. Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name> * [shell] exit immediately when called from non-interactive shell The shell execution environment shouldn’t be modified at all, when called from a non-interactive shell. It shall be noted that the current check may become error prone for bash, namely in case there should ever be a differentiation between `i` and `I` in the special variable `-` and bash’s `nocasematch`-shell-option be used. Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2023-10-04[shell] Avoid side-effects during eval (#3459)Junegunn Choi
Take two. * Avoid eval if the prefix contains `:=` * This is not to evaluate variable assignment. e.g. ${FOO:=BAR} * [zsh] Prevent `>(...)` form * Suppress error message from prefix evaluation * Stop completion when prefix evaluation failed Thanks to @calestyo
2023-10-02[completion] Prevent running a command during 'eval'Junegunn Choi
Do not attempt to provide fuzzy completion if the prefix contains a pattern that may start an arbitraty command. * $(...) * `...` * <(...) Close #3459
2023-09-19[shell] Use --scheme=path when appropriateJunegunn Choi
Without the option, you may get suboptimal results if you have many paths with spaces in their names. e.g. https://github.com/junegunn/fzf/issues/2909#issuecomment-1207690770 Close #3433
2023-09-18Basic context-aware completion for ssh command (#3424)Timofei Bredov
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2023-04-01[shell] Update kill completionJunegunn Choi
* Explicitly specify the list of fields for consistent experience * Add fallback command for BusyBox (Close #3219) * Apply `--header-lines=1` to show the column header
2022-10-16[shell] Make bash/zsh completion and bindings work with 'set -u' (#2999)John Fred Fadrigalan
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2022-08-22[completion] Remove extra trailing slash on directory completionJunegunn Choi
Fix #2931
2022-08-03[completion] ssh: Remove values with '%' (#2548)lbesnard
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>