Skip to content

Instantly share code, notes, and snippets.

@nickcarenza
Last active August 29, 2015 14:02
Show Gist options
  • Save nickcarenza/0a0dd28db5108b0c72fc to your computer and use it in GitHub Desktop.
Save nickcarenza/0a0dd28db5108b0c72fc to your computer and use it in GitHub Desktop.
Provides tab completion of vagrant IDs and displays global-status report
#compdef vagrant
local context state line
typeset -A opt_args
local vagrant_status vagrant_ids
vagrant_status=$(vagrant global-status | head -5)
vagrant_ids=$(echo $vagrant_status | grep -oE '^[0-9a-z]+' | grep '[0-9]')
_arguments "2:$vagrant_status:($vagrant_ids)"
@nickcarenza
Copy link
Author

Make sure you name this file starting with an underscore _ and save it somewhere in your $fpath.

In case your output is wonky, here are the zstyles I copied and pasted from somewhere:

zstyle ':completion:*' menu select=2
zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*' group-name ''

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment