summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2018-10-01 16:50:17 +0200
committerGitHub <noreply@github.com>2018-10-01 16:50:17 +0200
commit40a60d2847ad89fe73b1057ab61f0d6af168da38 (patch)
treea788124e26c09d002ecacfb2fb4ef728b7af5dc2 /plugins
parent6dcea3deca431649dd715aad8c16038751e5a923 (diff)
parent36808ff61ef5ca8888f14ba920c44a8350fb5ad2 (diff)
downloadzsh-40a60d2847ad89fe73b1057ab61f0d6af168da38.tar.gz
zsh-40a60d2847ad89fe73b1057ab61f0d6af168da38.tar.bz2
zsh-40a60d2847ad89fe73b1057ab61f0d6af168da38.zip
chruby: add "system" to completion list if available (#5280)
Detect system Ruby in default `PATH`, and provide "system" completion if found. Tested with [the Dockerfile](https://gist.github.com/franklinyu/b8deda6a5093a17b575679b5808b371f).
Diffstat (limited to 'plugins')
-rw-r--r--plugins/chruby/chruby.plugin.zsh8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/chruby/chruby.plugin.zsh b/plugins/chruby/chruby.plugin.zsh
index 998d92098..f7fedb5f2 100644
--- a/plugins/chruby/chruby.plugin.zsh
+++ b/plugins/chruby/chruby.plugin.zsh
@@ -111,5 +111,11 @@ function chruby_prompt_info() {
}
# complete on installed rubies
-_chruby() { compadd $(chruby | tr -d '* ') }
+_chruby() {
+ compadd $(chruby | tr -d '* ')
+ local default_path='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
+ if PATH=${default_path} type ruby &> /dev/null; then
+ compadd system
+ fi
+}
compdef _chruby chruby