mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
Add helper method to cd directly to the directory where a gem's source code is located
This commit is contained in:
parent
7a41498b0d
commit
a80598582d
1 changed files with 9 additions and 0 deletions
|
|
@ -42,3 +42,12 @@ function gems {
|
|||
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
|
||||
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
|
||||
}
|
||||
|
||||
# Go to the directory where the given gem is defined.
|
||||
#
|
||||
# Credit to: https://github.com/henrik/dotfiles/blob/master/bash/functions.sh
|
||||
function cdgem {
|
||||
local target=${1?No name for a gem given}
|
||||
local gemdir=`rvm gemdir`
|
||||
cd ${gemdir}/gems; cd $(find . -maxdepth 1 -name "*${target}*" | sort | tail -1)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue