summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2020-02-20 00:28:16 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2020-02-20 00:28:16 +0900
commit52154153150d0014a76ef8b429b73c590cb7f755 (patch)
tree7f745c14ac4cda8a8c148daab53bf3e87423c744 /README.md
parent54891d11e09d3491dffa3f494199064583ac4862 (diff)
[completion] Allow users to customize fzf options via _fzf_comprun
Related #1809 #1850
Diffstat (limited to 'README.md')
-rw-r--r--README.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/README.md b/README.md
index e138ebb6..b3c7cae0 100644
--- a/README.md
+++ b/README.md
@@ -403,6 +403,21 @@ _fzf_compgen_path() {
_fzf_compgen_dir() {
fd --type d --hidden --follow --exclude ".git" . "$1"
}
+
+# (EXPERIMENTAL) Advanced customization of fzf options via _fzf_comprun function
+# - The first argument to the function is the name of the command.
+# - You should make sure to pass the rest of the arguments to fzf.
+_fzf_comprun() {
+ local command=$1
+ shift
+
+ case "$command" in
+ cd) fzf "$@" --preview 'tree -C {} | head -200' ;;
+ export|unset) fzf "$@" --preview "eval 'echo \$'{}" "$@" ;;
+ ssh) fzf "$@" --preview 'dig {}' ;;
+ *) fzf "$@" ;;
+ esac
+}
```
#### Supported commands