Merge pull request #481 from mgkurtz/zsh-completions

Improve zsh completion
This commit is contained in:
Benjamin Sago 2019-03-16 19:22:13 +00:00 committed by GitHub
commit bddfe1b403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,17 @@
#compdef exa #compdef exa
# Save this file as _exa in /usr/local/share/zsh/site-functions or in any
# other folder in $fpath. E. g. save it in a folder called ~/.zfunc and add a
# line containing `fpath=(~/.zfunc $fpath)` somewhere before `compinit` in your
# ~/.zshrc.
__exa() { __exa() {
_arguments \ # Give completions using the `_arguments` utility function with
"(- 1 *)"{-v,--version}"[Show version of exa]" \ # `-s` for option stacking like `exa -ab` for `exa -a -b` and
"(- 1 *)"{-\?,--help}"[Show list of command-line options]" \ # `-S` for delimiting options with `--` like in `exa -- -a`.
_arguments -s -S \
"(- *)"{-v,--version}"[Show version of exa]" \
"(- *)"{-'\?',--help}"[Show list of command-line options]" \
{-1,--oneline}"[Display one entry per line]" \ {-1,--oneline}"[Display one entry per line]" \
{-l,--long}"[Display extended file metadata as a table]" \ {-l,--long}"[Display extended file metadata as a table]" \
{-G,--grid}"[Display entries as a grid]" \ {-G,--grid}"[Display entries as a grid]" \
@ -11,15 +19,15 @@ __exa() {
{-R,--recurse}"[Recurse into directories]" \ {-R,--recurse}"[Recurse into directories]" \
{-T,--tree}"[Recurse into directories as a tree]" \ {-T,--tree}"[Recurse into directories as a tree]" \
{-F,--classify}"[Display type indicator by file names]" \ {-F,--classify}"[Display type indicator by file names]" \
{--color,--colour}"[When to use terminal colours]" \ --colo{,u}r"[When to use terminal colours]" \
{--color,--colour}-scale"[Highlight levels of file sizes distinctly]" \ --colo{,u}r-scale"[Highlight levels of file sizes distinctly]" \
--group-directories-first"[Sort directories before other files]" \ --group-directories-first"[Sort directories before other files]" \
--git-ignore"[Ignore files mentioned in '.gitignore']" \ --git-ignore"[Ignore files mentioned in '.gitignore']" \
{-a,--all}"[Show hidden and 'dot' files]" \ {-a,--all}"[Show hidden and 'dot' files]" \
{-d,--list-dirs}"[List directories like regular files]" \ {-d,--list-dirs}"[List directories like regular files]" \
{-L,--level}"+[Limit the depth of recursion]" \ {-L,--level}"+[Limit the depth of recursion]" \
{-r,--reverse}"[Reverse the sort order]" \ {-r,--reverse}"[Reverse the sort order]" \
{-s,--sort}"[Which field to sort by]:(sort field):(accessed age created date extension Extension filename Filename inode modified oldest name Name newest none size time type)" \ {-s,--sort}="[Which field to sort by]:(sort field):(accessed age created date extension Extension filename Filename inode modified oldest name Name newest none size time type)" \
{-I,--ignore-glob}"[Ignore files that match these glob patterns]" \ {-I,--ignore-glob}"[Ignore files that match these glob patterns]" \
{-b,--binary}"[List file sizes with binary prefixes]" \ {-b,--binary}"[List file sizes with binary prefixes]" \
{-B,--bytes}"[List file sizes in bytes, without any prefixes]" \ {-B,--bytes}"[List file sizes in bytes, without any prefixes]" \
@ -29,8 +37,8 @@ __exa() {
{-i,--inode}"[List each file's inode number]" \ {-i,--inode}"[List each file's inode number]" \
{-m,--modified}"[Use the modified timestamp field]" \ {-m,--modified}"[Use the modified timestamp field]" \
{-S,--blocks}"[List each file's number of filesystem blocks]" \ {-S,--blocks}"[List each file's number of filesystem blocks]" \
{-t,--time}"[Which time field to show]:(time field):(accessed created modified)" \ {-t,--time}="[Which time field to show]:(time field):(accessed created modified)" \
--time-style"[How to format timestamps]:(time style):(default iso long-iso full-iso)" \ --time-style="[How to format timestamps]:(time style):(default iso long-iso full-iso)" \
{-u,--accessed}"[Use the accessed timestamp field]" \ {-u,--accessed}"[Use the accessed timestamp field]" \
{-U,--created}"[Use the created timestamp field]" \ {-U,--created}"[Use the created timestamp field]" \
--git"[List each file's Git status, if tracked]" \ --git"[List each file's Git status, if tracked]" \