diff options
author | Pierre Neidhardt <ambrevar@gmail.com> | 2016-12-14 12:07:27 +0530 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2016-12-14 15:37:27 +0900 |
commit | 0508e70f9bf941e3429668fcef955919a71e03c2 (patch) | |
tree | 0a1b38224f34a6085d9476bb0da226523cddc8a6 /README.md | |
parent | 8a502af4c126bc5649450d25d9c847da2711a739 (diff) |
Overhaul fish functions (#759)
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.
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 31 |
1 files changed, 28 insertions, 3 deletions
@@ -434,11 +434,36 @@ export FZF_DEFAULT_COMMAND=' It's [a known bug of fish](https://github.com/fish-shell/fish-shell/issues/1362) that it doesn't allow reading from STDIN in command substitution, which means -simple `vim (fzf)` won't work as expected. The workaround is to store the result -of fzf to a temporary file. +simple `vim (fzf)` won't work as expected. The workaround is to use the `read` +fish command: ```sh -fzf > $TMPDIR/fzf.result; and vim (cat $TMPDIR/fzf.result) +fzf | read -l result; and vim $result +``` + +or, for multiple results: + +```sh +fzf -m | while read -l r; set result $result $r; end; and vim $result +``` + +The globbing system is different in fish and thus `**` completion will not work. +However, the `CTRL-T` command will use the last token on the commandline as the +root folder for the recursive search. For instance, hitting `CTRL-T` at the end +of the following commandline + +```sh +ls /var/ +``` + +will list all files and folders under `/var/`. + +When using a custom `FZF_CTRL_T_COMMAND`, use the unexpanded `$dir` variable to +make use of this feature. `$dir` defaults to `.` when the last token is not a +valid directory. Example: + +```sh +set -l FZF_CTRL_T_COMMAND "command find -L \$dir -type f 2> /dev/null | sed '1d; s#^\./##'" ``` License |