OK, a little background: I use a Mac, and I do as much as possible in the CLI.In particular, I frequently pop in a USB stick, cp or mv a file over, and then immediately wish to eject (unmount and disconnect) it. This can usually be accomplished in a handful of keystrokes, except for unmounting it, which requires (in 10.7) going to an empty desktop space (usually two spaces away at least), selecting the disk, and pressing command-e. Frankly, this unmount procedure is, by several orders of magnitude, the most time-consuming and tedious part of the process.It would be far more natural and efficient to simply be able to type, say:ej<tab> J<tab>Say my USB stick mounts at /Volumes/Jefferson. What I would expect to get from my 6 keystrokes is the following:eject /Volumes/JeffersonThis should run the command:diskutil unmount /Volumes/JeffersonSo, I wrote a nice little function: eject() {    diskutil unmount /Volumes/$1}And a completion function to go with it:compdef '_files -g /Volumes/*' eject  There is a problem with this, however. The _files function generates complete paths. Now, I could change the line in my eject function to diskutil unmount $1, and things would work, but then I have no ability to type the first letter of the mount point name, since the path starts with /Volumes/. For instance, if I type J<tab, I will get autocompletion for the files in the PWD. I would have to type /Volumes/J<tab> to get the desired completion.So, is there a completion function which grabs filenames from a predefined, specific location, rather than generating complete paths? I'd really like to get this down to 6 keystrokes.
zsh completion: getting file names from a specific directory
zsh;osx;autocomplete
_files -W /VolumesSee the documentation of _path_files.