bc00362a01d5f459bbe33a10784b420a110bc9df
- Author
- Sébastien M-B <essembeh@gmail.com>
- Committer
- Sébastien M-B <essembeh@gmail.com>
- Date
Message
Merge remote-tracking branch 'upstream/master'
Diff
1diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh
2new file mode 100644
3index 0000000000000000000000000000000000000000..ba3765b83ce12893215ea45c10665ccd2517f2ef
4--- /dev/null
5+++ b/plugins/pj/pj.plugin.zsh
6@@ -0,0 +1,42 @@
7+#!/bin/zsh
8+
9+#
10+# Original idea by DefV (Jan De Poorter)
11+# Source: https://gist.github.com/pjaspers/368394#comment-1016
12+#
13+# Usage:
14+# - Set `$PROJECT_PATHS` in your ~/.zshrc
15+# e.g.: PROJECT_PATHS=(~/src ~/work)
16+# - In ZSH you now can open a project directory with the command: `pj my-project`
17+# the plugin will locate the `my-project` directory in one of the $PROJECT_PATHS
18+# Also tab completion is supported.
19+# - `pjo my-project` will open the directory in $EDITOR
20+#
21+
22+function pj() {
23+ cmd="cd"
24+ file=$1
25+
26+ if [[ "open" == "$file" ]] then
27+ file=$2
28+ cmd=(${(s: :)EDITOR})
29+ fi
30+
31+ for project in $PROJECT_PATHS; do
32+ if [[ -d $project/$file ]] then
33+ $cmd "$project/$file"
34+ unset project # Unset project var
35+ return
36+ fi
37+ done
38+
39+ echo "No such project $1"
40+}
41+
42+alias pjo="pj open"
43+
44+function _pj () {
45+ compadd `/bin/ls -l $PROJECT_PATHS 2>/dev/null | awk '{ print $9 }'`
46+}
47+
48+compdef _pj pj
49diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh
50index d855c244552ebd6e2b418108c0d3cce1f8fa7202..fb9df4bdd89fa7db15bbe21d23ef4a5097f07652 100644
51--- a/plugins/rbenv/rbenv.plugin.zsh
52+++ b/plugins/rbenv/rbenv.plugin.zsh
53@@ -32,11 +32,11 @@ for rbenvdir in "${rbenvdirs[@]}" ; do
54
55 function gems {
56 local rbenv_path=$(rbenv prefix)
57- gem list $@ | sed \
58- -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
59- -Ee "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \
60- -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
61- -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
62+ gem list $@ | sed -E \
63+ -e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
64+ -e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \
65+ -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
66+ -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
67 }
68
69 function rbenv_prompt_info() {