1e7033d6600823d90cbadcaa7ea696ee7a88afe8
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/fd/README.md b/plugins/fd/README.md
2new file mode 100644
3index 0000000000000000000000000000000000000000..aabd624b8d63d6a1204773045fefc1ff12c8297e
4--- /dev/null
5+++ b/plugins/fd/README.md
6@@ -0,0 +1,13 @@
7+# fd
8+
9+This plugin adds completion for the file search tool [`fd`](https://github.com/sharkdp/fd), also known as `fd-find`.
10+
11+To use it, add `fd` to the plugins array in your zshrc file:
12+
13+```zsh
14+plugins=(... fd)
15+```
16+
17+Completion is taken from the fd release [`7.3.0`](https://github.com/sharkdp/fd/releases/tag/v7.3.0).
18+
19+Updated on Febrary 13th, 2019.
20diff --git a/plugins/fd/_fd b/plugins/fd/_fd
21new file mode 100644
22index 0000000000000000000000000000000000000000..7d65c7856978695a27e33bf2cad350e08d6180bb
23--- /dev/null
24+++ b/plugins/fd/_fd
25@@ -0,0 +1,83 @@
26+#compdef fd
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+
98+}
99+
100+(( $+functions[_fd_commands] )) ||
101+_fd_commands() {
102+ local commands; commands=(
103+
104+ )
105+ _describe -t commands 'fd commands' commands "$@"
106+}
107+
108+_fd "$@"
109diff --git a/plugins/ripgrep/README.md b/plugins/ripgrep/README.md
110new file mode 100644
111index 0000000000000000000000000000000000000000..794b105eef107d71855a4d3a906c8fd7970cb301
112--- /dev/null
113+++ b/plugins/ripgrep/README.md
114@@ -0,0 +1,13 @@
115+# ripgrep
116+
117+This plugin adds completion for the text search tool [`ripgrep`](https://github.com/BurntSushi/ripgrep), also known as `rg`.
118+
119+To use it, add `ripgrep` to the plugins array in your zshrc file:
120+
121+```zsh
122+plugins=(... ripgrep)
123+```
124+
125+Completion is taken from the ripgrep release [`0.10.0`](https://github.com/BurntSushi/ripgrep/releases/tag/0.10.0).
126+
127+Updated on September 27th, 2018.
128diff --git a/plugins/ripgrep/_ripgrep b/plugins/ripgrep/_ripgrep
129new file mode 100644
130index 0000000000000000000000000000000000000000..53f135dde9fda080dee3766e05a7ffb974d885ce
131--- /dev/null
132+++ b/plugins/ripgrep/_ripgrep
133@@ -0,0 +1,433 @@
134+#compdef rg
135+
136+##
137+# zsh completion function for ripgrep
138+#
139+# Originally based on code from the zsh-users project — see copyright notice
140+# below.
141+
142+_rg() {
143+ local curcontext=$curcontext no='!' descr ret=1
144+ local -a context line state state_descr args tmp suf
145+ local -A opt_args
146+
147+ # ripgrep has many options which negate the effect of a more common one — for
148+ # example, `--no-column` to negate `--column`, and `--messages` to negate
149+ # `--no-messages`. There are so many of these, and they're so infrequently
150+ # used, that some users will probably find it irritating if they're completed
151+ # indiscriminately, so let's not do that unless either the current prefix
152+ # matches one of those negation options or the user has the `complete-all`
153+ # style set. Note that this prefix check has to be updated manually to account
154+ # for all of the potential negation options listed below!
155+ if
156+ # We also want to list all of these options during testing
157+ [[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] ||
158+ # (--[imnp]* => --ignore*, --messages, --no-*, --pcre2-unicode)
159+ [[ $PREFIX$SUFFIX == --[imnp]* ]] ||
160+ zstyle -t ":complete:$curcontext:*" complete-all
161+ then
162+ no=
163+ fi
164+
165+ # We make heavy use of argument groups here to prevent the option specs from
166+ # growing unwieldy. These aren't supported in zsh <5.4, though, so we'll strip
167+ # them out below if necessary. This makes the exclusions inaccurate on those
168+ # older versions, but oh well — it's not that big a deal
169+ args=(
170+ + '(exclusive)' # Misc. fully exclusive options
171+ '(: * -)'{-h,--help}'[display help information]'
172+ '(: * -)'{-V,--version}'[display version information]'
173+
174+ + '(buffered)' # buffering options
175+ '--line-buffered[force line buffering]'
176+ $no"--no-line-buffered[don't force line buffering]"
177+ '--block-buffered[force block buffering]'
178+ $no"--no-block-buffered[don't force block buffering]"
179+
180+ + '(case)' # Case-sensitivity options
181+ {-i,--ignore-case}'[search case-insensitively]'
182+ {-s,--case-sensitive}'[search case-sensitively]'
183+ {-S,--smart-case}'[search case-insensitively if pattern is all lowercase]'
184+
185+ + '(context-a)' # Context (after) options
186+ '(context-c)'{-A+,--after-context=}'[specify lines to show after each match]:number of lines'
187+
188+ + '(context-b)' # Context (before) options
189+ '(context-c)'{-B+,--before-context=}'[specify lines to show before each match]:number of lines'
190+
191+ + '(context-c)' # Context (combined) options
192+ '(context-a context-b)'{-C+,--context=}'[specify lines to show before and after each match]:number of lines'
193+
194+ + '(column)' # Column options
195+ '--column[show column numbers for matches]'
196+ $no"--no-column[don't show column numbers for matches]"
197+
198+ + '(count)' # Counting options
199+ {-c,--count}'[only show count of matching lines for each file]'
200+ '--count-matches[only show count of individual matches for each file]'
201+
202+ + '(encoding)' # Encoding options
203+ {-E+,--encoding=}'[specify text encoding of files to search]: :_rg_encodings'
204+ $no'--no-encoding[use default text encoding]'
205+
206+ + file # File-input options
207+ '(1)*'{-f+,--file=}'[specify file containing patterns to search for]: :_files'
208+
209+ + '(file-match)' # Files with/without match options
210+ '(stats)'{-l,--files-with-matches}'[only show names of files with matches]'
211+ '(stats)--files-without-match[only show names of files without matches]'
212+
213+ + '(file-name)' # File-name options
214+ {-H,--with-filename}'[show file name for matches]'
215+ "--no-filename[don't show file name for matches]"
216+
217+ + '(file-system)' # File system options
218+ "--one-file-system[don't descend into directories on other file systems]"
219+ $no'--no-one-file-system[descend into directories on other file systems]'
220+
221+ + '(fixed)' # Fixed-string options
222+ {-F,--fixed-strings}'[treat pattern as literal string instead of regular expression]'
223+ $no"--no-fixed-strings[don't treat pattern as literal string]"
224+
225+ + '(follow)' # Symlink-following options
226+ {-L,--follow}'[follow symlinks]'
227+ $no"--no-follow[don't follow symlinks]"
228+
229+ + glob # File-glob options
230+ '*'{-g+,--glob=}'[include/exclude files matching specified glob]:glob'
231+ '*--iglob=[include/exclude files matching specified case-insensitive glob]:glob'
232+