my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
3.4 KiB

3 years ago
  1. #compdef ag
  2. #autoload
  3. typeset -A opt_args
  4. # Took the liberty of not listing every option… specially aliases and -D
  5. _ag () {
  6. local -a _1st_arguments
  7. _1st_arguments=(
  8. '--ackmate:Print results in AckMate-parseable format'
  9. {'-A','--after'}':[LINES] Print lines after match (Default: 2)'
  10. {'-B','--before'}':[LINES] Print lines before match (Default: 2)'
  11. '--break:Print newlines between matches in different files'
  12. '--nobreak:Do not print newlines between matches in different files'
  13. {'-c','--count'}':Only print the number of matches in each file'
  14. '--color:Print color codes in results (Default: On)'
  15. '--nocolor:Do not print color codes in results'
  16. '--color-line-number:Color codes for line numbers (Default: 1;33)'
  17. '--color-match:Color codes for result match numbers (Default: 30;43)'
  18. '--color-path:Color codes for path names (Default: 1;32)'
  19. '--column:Print column numbers in results'
  20. {'-H','--heading'}':Print file names (On unless searching a single file)'
  21. '--noheading:Do not print file names (On unless searching a single file)'
  22. '--line-numbers:Print line numbers even for streams'
  23. {'-C','--context'}':[LINES] Print lines before and after matches (Default: 2)'
  24. '-g:[PATTERN] Print filenames matching PATTERN'
  25. {'-l','--files-with-matches'}':Only print filenames that contain matches'
  26. {'-L','--files-without-matches'}':Only print filenames that do not contain matches'
  27. '--no-numbers:Do not print line numbers'
  28. {'-o','--only-matching'}':Prints only the matching part of the lines'
  29. '--print-long-lines:Print matches on very long lines (Default: 2k characters)'
  30. '--passthrough:When searching a stream, print all lines even if they do not match'
  31. '--silent:Suppress all log messages, including errors'
  32. '--stats:Print stats (files scanned, time taken, etc.)'
  33. '--vimgrep:Print results like vim :vimgrep /pattern/g would'
  34. {'-0','--null'}':Separate filenames with null (for "xargs -0")'
  35. {'-a','--all-types'}':Search all files (does not include hidden files / .gitignore)'
  36. '--depth:[NUM] Search up to NUM directories deep (Default: 25)'
  37. {'-f','--follow'}':Follow symlinks'
  38. {'-G','--file-search-regex'}':[PATTERN] Limit search to filenames matching PATTERN'
  39. '--hidden:Search hidden files (obeys .*ignore files)'
  40. {'-i','--ignore-case'}':Match case insensitively'
  41. '--ignore:[PATTERN] Ignore files/directories matching PATTERN'
  42. {'-m','--max-count'}':[NUM] Skip the rest of a file after NUM matches (Default: 10k)'
  43. {'-p','--path-to-agignore'}':[PATH] Use .agignore file at PATH'
  44. {'-Q','--literal'}':Do not parse PATTERN as a regular expression'
  45. {'-s','--case-sensitive'}':Match case'
  46. {'-S','--smart-case'}':Insensitive match unless PATTERN has uppercase (Default: On)'
  47. '--search-binary:Search binary files for matches'
  48. {'-t','--all-text'}':Search all text files (Hidden files not included)'
  49. {'-u','--unrestricted'}':Search all files (ignore .agignore and _all_)'
  50. {'-U','--skip-vcs-ignores'}':Ignore VCS files (stil obey .agignore)'
  51. {'-v','--invert-match'}':Invert match'
  52. {'-w','--word-regexp'}':Only match whole words'
  53. {'-z','--search-zip'}':Search contents of compressed (e.g., gzip) files'
  54. '--list-file-types:list of supported file types'
  55. )
  56. if [[ $words[-1] =~ "^-" ]]; then
  57. _describe -t commands "ag options" _1st_arguments && ret=0
  58. else
  59. _files && ret=0
  60. fi
  61. }