summaryrefslogtreecommitdiff
path: root/plugins/ag
diff options
context:
space:
mode:
authorRobby Russell <robby@planetargon.com>2021-06-13 08:13:21 -0700
committerRobby Russell <robby@planetargon.com>2021-06-13 08:13:21 -0700
commitc65153739adc34b68ebf8b37dbd61dd845a55790 (patch)
treed713d136e0f71c82c3584ef01f17b4cb270cf114 /plugins/ag
parent43a9eed263aafdf7796a179d1f1c68f43a6ff411 (diff)
parent5b3657a454efdd5d27753c049cc2e2f1c4d82bc7 (diff)
downloadzsh-c65153739adc34b68ebf8b37dbd61dd845a55790.tar.gz
zsh-c65153739adc34b68ebf8b37dbd61dd845a55790.tar.bz2
zsh-c65153739adc34b68ebf8b37dbd61dd845a55790.zip
Merge branch 'master' of github.com:ohmyzsh/ohmyzsh
Diffstat (limited to 'plugins/ag')
-rw-r--r--plugins/ag/README.md13
-rw-r--r--plugins/ag/_ag66
2 files changed, 79 insertions, 0 deletions
diff --git a/plugins/ag/README.md b/plugins/ag/README.md
new file mode 100644
index 000000000..6acc54067
--- /dev/null
+++ b/plugins/ag/README.md
@@ -0,0 +1,13 @@
+# The Silver Searcher
+
+This plugin provides completion support for [`ag`](https://github.com/ggreer/the_silver_searcher).
+
+To use it, add ag to the plugins array in your zshrc file.
+
+```zsh
+plugins=(... aws)
+```
+
+## INSTALLATION NOTES
+
+Besides oh-my-zsh, `ag` needs to be installed by following these steps: https://github.com/ggreer/the_silver_searcher#installing.
diff --git a/plugins/ag/_ag b/plugins/ag/_ag
new file mode 100644
index 000000000..25b0c27a7
--- /dev/null
+++ b/plugins/ag/_ag
@@ -0,0 +1,66 @@
+#compdef ag
+#autoload
+
+typeset -A opt_args
+
+# Took the liberty of not listing every option… specially aliases and -D
+_ag () {
+ local -a _1st_arguments
+ _1st_arguments=(
+ '--ackmate:Print results in AckMate-parseable format'
+ {'-A','--after'}':[LINES] Print lines after match (Default: 2)'
+ {'-B','--before'}':[LINES] Print lines before match (Default: 2)'
+ '--break:Print newlines between matches in different files'
+ '--nobreak:Do not print newlines between matches in different files'
+ {'-c','--count'}':Only print the number of matches in each file'
+ '--color:Print color codes in results (Default: On)'
+ '--nocolor:Do not print color codes in results'
+ '--color-line-number:Color codes for line numbers (Default: 1;33)'
+ '--color-match:Color codes for result match numbers (Default: 30;43)'
+ '--color-path:Color codes for path names (Default: 1;32)'
+ '--column:Print column numbers in results'
+ {'-H','--heading'}':Print file names (On unless searching a single file)'
+ '--noheading:Do not print file names (On unless searching a single file)'
+ '--line-numbers:Print line numbers even for streams'
+ {'-C','--context'}':[LINES] Print lines before and after matches (Default: 2)'
+ '-g:[PATTERN] Print filenames matching PATTERN'
+ {'-l','--files-with-matches'}':Only print filenames that contain matches'
+ {'-L','--files-without-matches'}':Only print filenames that do not contain matches'
+ '--no-numbers:Do not print line numbers'
+ {'-o','--only-matching'}':Prints only the matching part of the lines'
+ '--print-long-lines:Print matches on very long lines (Default: 2k characters)'
+ '--passthrough:When searching a stream, print all lines even if they do not match'
+ '--silent:Suppress all log messages, including errors'
+ '--stats:Print stats (files scanned, time taken, etc.)'
+ '--vimgrep:Print results like vim :vimgrep /pattern/g would'
+ {'-0','--null'}':Separate filenames with null (for "xargs -0")'
+
+ {'-a','--all-types'}':Search all files (does not include hidden files / .gitignore)'
+ '--depth:[NUM] Search up to NUM directories deep (Default: 25)'
+ {'-f','--follow'}':Follow symlinks'
+ {'-G','--file-search-regex'}':[PATTERN] Limit search to filenames matching PATTERN'
+ '--hidden:Search hidden files (obeys .*ignore files)'
+ {'-i','--ignore-case'}':Match case insensitively'
+ '--ignore:[PATTERN] Ignore files/directories matching PATTERN'
+ {'-m','--max-count'}':[NUM] Skip the rest of a file after NUM matches (Default: 10k)'
+ {'-p','--path-to-agignore'}':[PATH] Use .agignore file at PATH'
+ {'-Q','--literal'}':Do not parse PATTERN as a regular expression'
+ {'-s','--case-sensitive'}':Match case'
+ {'-S','--smart-case'}':Insensitive match unless PATTERN has uppercase (Default: On)'
+ '--search-binary:Search binary files for matches'
+ {'-t','--all-text'}':Search all text files (Hidden files not included)'
+ {'-u','--unrestricted'}':Search all files (ignore .agignore and _all_)'
+ {'-U','--skip-vcs-ignores'}':Ignore VCS files (stil obey .agignore)'
+ {'-v','--invert-match'}':Invert match'
+ {'-w','--word-regexp'}':Only match whole words'
+ {'-z','--search-zip'}':Search contents of compressed (e.g., gzip) files'
+
+ '--list-file-types:list of supported file types'
+ )
+
+ if [[ $words[-1] =~ "^-" ]]; then
+ _describe -t commands "ag options" _1st_arguments && ret=0
+ else
+ _files && ret=0
+ fi
+}