diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/brew-cask/brew-cask.plugin.zsh | 84 | ||||
-rw-r--r-- | plugins/bundler/bundler.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/docker/_docker | 2 | ||||
-rw-r--r-- | plugins/git-prompt/gitstatus.py | 2 | ||||
-rw-r--r-- | plugins/history-substring-search/history-substring-search.zsh | 9 |
5 files changed, 94 insertions, 5 deletions
diff --git a/plugins/brew-cask/brew-cask.plugin.zsh b/plugins/brew-cask/brew-cask.plugin.zsh new file mode 100644 index 000000000..91ce0f498 --- /dev/null +++ b/plugins/brew-cask/brew-cask.plugin.zsh @@ -0,0 +1,84 @@ +# Autocompletion for homebrew-cask. +# +# This script intercepts calls to the brew plugin and adds autocompletion +# for the cask subcommand. +# +# Author: https://github.com/pstadler + +compdef _brew-cask brew + +_brew-cask() +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + ':subcmd:->subcmd' \ + '*::options:->options' + + case $state in + (command) + __call_original_brew + cask_commands=( + 'cask:manage casks' + ) + _describe -t commands 'brew cask command' cask_commands ;; + + (subcmd) + case "$line[1]" in + cask) + if (( CURRENT == 3 )); then + local -a subcommands + subcommands=( + "alfred:used to modify Alfred's scope to include the Caskroom" + 'audit:verifies installability of casks' + 'checklinks:checks for bad cask links' + 'cleanup:cleans up cached downloads' + 'create:creates a cask of the given name and opens it in an editor' + 'doctor:checks for configuration issues' + 'edit:edits the cask of the given name' + 'fetch:downloads Cask resources to local cache' + 'home:opens the homepage of the cask of the given name' + 'info:displays information about the cask of the given name' + 'install:installs the cask of the given name' + 'list:with no args, lists installed casks; given installed casks, lists installed files' + 'search:searches all known casks' + 'uninstall:uninstalls the cask of the given name' + "update:a synonym for 'brew update'" + ) + _describe -t commands "brew cask subcommand" subcommands + fi ;; + + *) + __call_original_brew ;; + esac ;; + + (options) + local -a casks installed_casks + local expl + case "$line[2]" in + list|uninstall) + __brew_installed_casks + _wanted installed_casks expl 'installed casks' compadd -a installed_casks ;; + audit|edit|home|info|install) + __brew_all_casks + _wanted casks expl 'all casks' compadd -a casks ;; + esac ;; + esac +} + +__brew_all_casks() { + casks=(`brew cask search`) +} + +__brew_installed_casks() { + installed_casks=(`brew cask list`) +} + +__call_original_brew() +{ + local ret=1 + _call_function ret _brew + compdef _brew-cask brew +} diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index e4b03e7b0..3338d78be 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -6,7 +6,7 @@ alias bu="bundle update" # The following is based on https://github.com/gma/bundler-exec -bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard irb jekyll kitchen knife mailcatcher middleman nanoc puma rackup rainbows rake rspec ruby shotgun spec spin spork strainer tailor taps thin thor unicorn unicorn_rails) +bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard irb jekyll kitchen knife middleman nanoc puma rackup rainbows rake rspec ruby shotgun spec spin spork strainer tailor taps thin thor unicorn unicorn_rails) # Remove $UNBUNDLED_COMMANDS from the bundled_commands list for cmd in $UNBUNDLED_COMMANDS; do diff --git a/plugins/docker/_docker b/plugins/docker/_docker index 5acd19edf..c291037a3 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -166,7 +166,7 @@ __rm() { __rmi() { _arguments \ - '(-f,--force=)'{-f,--force=}'[Force]' \ + '(-f,--force=)'{-f,--force=}'[Force]' __docker_images } diff --git a/plugins/git-prompt/gitstatus.py b/plugins/git-prompt/gitstatus.py index ef894bff2..256841432 100644 --- a/plugins/git-prompt/gitstatus.py +++ b/plugins/git-prompt/gitstatus.py @@ -16,7 +16,7 @@ symbols = { } output, error = Popen( - ['git', 'status'], stdout=PIPE, stderr=PIPE).communicate() + ['git', 'status'], stdout=PIPE, stderr=PIPE, universal_newlines=True).communicate() if error: import sys diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh index 53f707c79..22f03dd6d 100644 --- a/plugins/history-substring-search/history-substring-search.zsh +++ b/plugins/history-substring-search/history-substring-search.zsh @@ -163,8 +163,13 @@ function history-substring-search-down() { zle -N history-substring-search-up zle -N history-substring-search-down -bindkey '\e[A' history-substring-search-up -bindkey '\e[B' history-substring-search-down +zmodload zsh/terminfo +if [[ -n "$terminfo[kcuu1]" ]]; then + bindkey "$terminfo[kcuu1]" history-substring-search-up +fi +if [[ -n "$terminfo[kcud1]" ]]; then + bindkey "$terminfo[kcud1]" history-substring-search-down +fi #----------------------------------------------------------------------------- # implementation details |