c65153739adc34b68ebf8b37dbd61dd845a55790

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge branch 'master' of github.com:ohmyzsh/ohmyzsh

Diff

 1diff --git a/plugins/ag/README.md b/plugins/ag/README.md
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..6acc5406711778a473f4c8559fd1dc003072aefd
 4--- /dev/null
 5+++ b/plugins/ag/README.md
 6@@ -0,0 +1,13 @@
 7+# The Silver Searcher
 8+
 9+This plugin provides completion support for [`ag`](https://github.com/ggreer/the_silver_searcher).
10+
11+To use it, add ag to the plugins array in your zshrc file.
12+
13+```zsh
14+plugins=(... aws)
15+```
16+
17+## INSTALLATION NOTES
18+
19+Besides oh-my-zsh, `ag` needs to be installed by following these steps: https://github.com/ggreer/the_silver_searcher#installing.
20diff --git a/plugins/ag/_ag b/plugins/ag/_ag
21new file mode 100644
22index 0000000000000000000000000000000000000000..25b0c27a7a750a08cf2ed2be336aab978d26d2bd
23--- /dev/null
24+++ b/plugins/ag/_ag
25@@ -0,0 +1,66 @@
26+#compdef ag
27+#autoload
28+
29+typeset -A opt_args
30+
31+# Took the liberty of not listing every option… specially aliases and -D
32+_ag () {
33+  local -a _1st_arguments
34+  _1st_arguments=(
35+    '--ackmate:Print results in AckMate-parseable format'
36+    {'-A','--after'}':[LINES] Print lines after match (Default: 2)'
37+    {'-B','--before'}':[LINES] Print lines before match (Default: 2)'
38+    '--break:Print newlines between matches in different files'
39+    '--nobreak:Do not print newlines between matches in different files'
40+    {'-c','--count'}':Only print the number of matches in each file'
41+    '--color:Print color codes in results (Default: On)'
42+    '--nocolor:Do not print color codes in results'
43+    '--color-line-number:Color codes for line numbers (Default: 1;33)'
44+    '--color-match:Color codes for result match numbers (Default: 30;43)'
45+    '--color-path:Color codes for path names (Default: 1;32)'
46+    '--column:Print column numbers in results'
47+    {'-H','--heading'}':Print file names (On unless searching a single file)'
48+    '--noheading:Do not print file names (On unless searching a single file)'
49+    '--line-numbers:Print line numbers even for streams'
50+    {'-C','--context'}':[LINES] Print lines before and after matches (Default: 2)'
51+    '-g:[PATTERN] Print filenames matching PATTERN'
52+    {'-l','--files-with-matches'}':Only print filenames that contain matches'
53+    {'-L','--files-without-matches'}':Only print filenames that do not contain matches'
54+    '--no-numbers:Do not print line numbers'
55+    {'-o','--only-matching'}':Prints only the matching part of the lines'
56+    '--print-long-lines:Print matches on very long lines (Default: 2k characters)'
57+    '--passthrough:When searching a stream, print all lines even if they do not match'
58+    '--silent:Suppress all log messages, including errors'
59+    '--stats:Print stats (files scanned, time taken, etc.)'
60+    '--vimgrep:Print results like vim :vimgrep /pattern/g would'
61+    {'-0','--null'}':Separate filenames with null (for "xargs -0")'
62+
63+    {'-a','--all-types'}':Search all files (does not include hidden files / .gitignore)'
64+    '--depth:[NUM] Search up to NUM directories deep (Default: 25)'
65+    {'-f','--follow'}':Follow symlinks'
66+    {'-G','--file-search-regex'}':[PATTERN] Limit search to filenames matching PATTERN'
67+    '--hidden:Search hidden files (obeys .*ignore files)'
68+    {'-i','--ignore-case'}':Match case insensitively'
69+    '--ignore:[PATTERN] Ignore files/directories matching PATTERN'
70+    {'-m','--max-count'}':[NUM] Skip the rest of a file after NUM matches (Default: 10k)'
71+    {'-p','--path-to-agignore'}':[PATH] Use .agignore file at PATH'
72+    {'-Q','--literal'}':Do not parse PATTERN as a regular expression'
73+    {'-s','--case-sensitive'}':Match case'
74+    {'-S','--smart-case'}':Insensitive match unless PATTERN has uppercase (Default: On)'
75+    '--search-binary:Search binary files for matches'
76+    {'-t','--all-text'}':Search all text files (Hidden files not included)'
77+    {'-u','--unrestricted'}':Search all files (ignore .agignore and _all_)'
78+    {'-U','--skip-vcs-ignores'}':Ignore VCS files (stil obey .agignore)'
79+    {'-v','--invert-match'}':Invert match'
80+    {'-w','--word-regexp'}':Only match whole words'
81+    {'-z','--search-zip'}':Search contents of compressed (e.g., gzip) files'
82+
83+    '--list-file-types:list of supported file types'
84+  )
85+
86+  if [[ $words[-1] =~ "^-" ]]; then
87+    _describe -t commands "ag options" _1st_arguments && ret=0
88+  else
89+    _files && ret=0
90+  fi
91+}