b04274f5db6f2f5a4006812018eab3ddd09c7354

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Add better trash-put autocomplete

Diff

 1diff --git a/dot_config/zsh/functions/_trash-put b/dot_config/zsh/functions/_trash-put
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..d5211db8ebb43b07d2a83b4bf7970c64e4921d62
 4--- /dev/null
 5+++ b/dot_config/zsh/functions/_trash-put
 6@@ -0,0 +1,23 @@
 7+#compdef trash-put
 8+
 9+# Overrides /usr/share/zsh/site-functions/_trash-put (shtab-generated) which
10+# uses `::files:` (optional single positional), so only the first arg
11+# completes as a file and subsequent args only offer flags.
12+
13+_trash_files() {
14+  (( CURRENT > 0 )) && line[CURRENT]=()
15+  line=( ${line//(#m)[\[\]()\\*?#<>~\^\|]/\\$MATCH} )
16+  _files -F line
17+}
18+
19+_arguments -s \
20+  '(- *)'{-h,--help}'[show this help message and exit]' \
21+  '(- *)--print-completion[print shell completion script]:shell:(bash zsh tcsh)' \
22+  '(- *)--version[show program version number and exit]' \
23+  {-d,--directory}'[ignored (for GNU rm compatibility)]' \
24+  {-f,--force}'[silently ignore nonexistent files]' \
25+  {-i,--interactive}'[prompt before every removal]' \
26+  {-r,-R,--recursive}'[ignored (for GNU rm compatibility)]' \
27+  '--trash-dir[use TRASHDIR as trash folder]:trashdir:_files -/' \
28+  '*'{-v,--verbose}'[explain what is being done]' \
29+  '*:files:_trash_files'