1d6553e631b6b54d3696e093cfe5d3d854d9b684
- Author
- András Svraka <svraka.andras@gmail.com>
- Committer
- Marc Cornellà <hello@mcornella.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/fd/README.md b/plugins/fd/README.md
2index 4d9cf190f8c14ea8bdc4478a61b1c9ef1658d10c..cf9f7815d6d8ab8b92ec554f75555cb820ab4c67 100644
3--- a/plugins/fd/README.md
4+++ b/plugins/fd/README.md
5@@ -8,6 +8,6 @@ To use it, add `fd` to the plugins array in your zshrc file:
6 plugins=(... fd)
7 ```
8
9-Completion is taken from the fd release [`7.3.0`](https://github.com/sharkdp/fd/releases/tag/v7.3.0).
10+Completion is taken from the fd release [`8.2.1`](https://github.com/sharkdp/fd/releases/tag/v8.2.1).
11
12-Updated on February 13th, 2019.
13+Updated on April 1st, 2021.
14diff --git a/plugins/fd/_fd b/plugins/fd/_fd
15index 7a4c387534ae4441480a4c5c37a338cfeea8d106..f5d9e01d20ae9f24e5946b9e5a1e2df75cf4c078 100644
16--- a/plugins/fd/_fd
17+++ b/plugins/fd/_fd
18@@ -1,83 +1,268 @@
19 #compdef fd fdfind
20
21+##
22+# zsh completion function for fd
23+#
24+# Based on ripgrep completion function.
25+# Originally based on code from the zsh-users project — see copyright notice
26+# below.
27+
28 autoload -U is-at-least
29
30 _fd() {
31- typeset -A opt_args
32- typeset -a _arguments_options
33- local ret=1
34-
35- if is-at-least 5.2; then
36- _arguments_options=(-s -S -C)
37- else
38- _arguments_options=(-s -C)
39- fi
40-
41- local context curcontext="$curcontext" state line
42- _arguments "${_arguments_options[@]}" \
43-'-d+[Set maximum search depth (default: none)]' \
44-'--max-depth=[Set maximum search depth (default: none)]' \
45-'--maxdepth=[See --max-depth]' \
46-'*-t+[Filter by type: file (f), directory (d), symlink (l),
47-executable (x), empty (e)]: :(f file d directory l symlink x executable e empty)' \
48-'*--type=[Filter by type: file (f), directory (d), symlink (l),
49-executable (x), empty (e)]: :(f file d directory l symlink x executable e empty)' \
50-'*-e+[Filter by file extension]' \
51-'*--extension=[Filter by file extension]' \
52-'-x+[Execute a command for each search result]' \
53-'--exec=[Execute a command for each search result]' \
54-'(-x --exec)-X+[Execute a command with all search results at once]' \
55-'(-x --exec)--exec-batch=[Execute a command with all search results at once]' \
56-'*-E+[Exclude entries that match the given glob pattern]' \
57-'*--exclude=[Exclude entries that match the given glob pattern]' \
58-'*--ignore-file=[Add a custom ignore-file in .gitignore format]' \
59-'-c+[When to use colors: never, *auto*, always]: :(never auto always)' \
60-'--color=[When to use colors: never, *auto*, always]: :(never auto always)' \
61-'-j+[Set number of threads to use for searching & executing]' \
62-'--threads=[Set number of threads to use for searching & executing]' \
63-'*-S+[Limit results based on the size of files.]' \
64-'*--size=[Limit results based on the size of files.]' \
65-'--max-buffer-time=[the time (in ms) to buffer, before streaming to the console]' \
66-'--changed-within=[Filter by file modification time (newer than)]' \
67-'--changed-before=[Filter by file modification time (older than)]' \
68-'*--search-path=[(hidden)]' \
69-'-H[Search hidden files and directories]' \
70-'--hidden[Search hidden files and directories]' \
71-'-I[Do not respect .(git|fd)ignore files]' \
72-'--no-ignore[Do not respect .(git|fd)ignore files]' \
73-'--no-ignore-vcs[Do not respect .gitignore files]' \
74-'*-u[Alias for no-ignore and/or hidden]' \
75-'-s[Case-sensitive search (default: smart case)]' \
76-'--case-sensitive[Case-sensitive search (default: smart case)]' \
77-'-i[Case-insensitive search (default: smart case)]' \
78-'--ignore-case[Case-insensitive search (default: smart case)]' \
79-'-F[Treat the pattern as a literal string]' \
80-'--fixed-strings[Treat the pattern as a literal string]' \
81-'-a[Show absolute instead of relative paths]' \
82-'--absolute-path[Show absolute instead of relative paths]' \
83-'-L[Follow symbolic links]' \
84-'--follow[Follow symbolic links]' \
85-'-p[Search full path (default: file-/dirname only)]' \
86-'--full-path[Search full path (default: file-/dirname only)]' \
87-'-0[Separate results by the null character]' \
88-'--print0[Separate results by the null character]' \
89-'--show-errors[Enable display of filesystem errors]' \
90-'-h[Prints help information]' \
91-'--help[Prints help information]' \
92-'-V[Prints version information]' \
93-'--version[Prints version information]' \
94-'::pattern -- the search pattern, a regular expression (optional):_files' \
95-'::path -- the root directory for the filesystem search (optional):_files' \
96-&& ret=0
97+ local curcontext="$curcontext" no='!' ret=1
98+ local -a context line state state_descr _arguments_options fd_types fd_args
99+ local -A opt_args
100
101-}
102+ if is-at-least 5.2; then
103+ _arguments_options=( -s -S )
104+ else
105+ _arguments_options=( -s )
106+ fi
107+
108+ fd_types=(
109+ {f,file}'\:"regular files"'
110+ {d,directory}'\:"directories"'
111+ {l,symlink}'\:"symbolic links"'
112+ {e,empty}'\:"empty files or directories"'
113+ {x,executable}'\:"executable (files)"'
114+ {s,socket}'\:"sockets"'
115+ {p,pipe}'\:"named pipes (FIFOs)"'
116+ )
117+