mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-08 04:34:00 +02:00
Merge c3ac1174c2 into 5667161d49
This commit is contained in:
commit
2288efba9a
1 changed files with 27 additions and 0 deletions
27
plugins/work/work.plugin.zsh
Normal file
27
plugins/work/work.plugin.zsh
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
typeset -A _WORKPLUGIN_DIRS_FULLPATH
|
||||
|
||||
for dir in $WORKPLUGIN_DIRS; do
|
||||
_WORKPLUGIN_DIRS_FULLPATH[$dir]="$HOME/$dir"
|
||||
done
|
||||
|
||||
work() {
|
||||
local dir
|
||||
for dir in $_WORKPLUGIN_DIRS_FULLPATH; do
|
||||
if [[ -d "$dir/$1" ]]; then
|
||||
builtin cd "$dir/$1"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ $(type -w "WORKPLUGIN_CALLBACK") == "WORKPLUGIN_CALLBACK: function" ]]; then
|
||||
WORKPLUGIN_CALLBACK "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
_work_comp() {
|
||||
local dir
|
||||
for dir in $_WORKPLUGIN_DIRS_FULLPATH; do
|
||||
compadd $(ls $dir)
|
||||
done
|
||||
}
|
||||
|
||||
compdef _work_comp work
|
||||
Loading…
Add table
Add a link
Reference in a new issue