mirror of
https://github.com/chenasraf/dotfiles.git
synced 2026-05-17 17:28:07 +00:00
feat: update prc/sprc + completions
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
#compdef src rc
|
||||
#compdef rc src
|
||||
dfpath="$(wd path df)"
|
||||
|
||||
out=()
|
||||
|
||||
__read_dir() {
|
||||
dir="$1"
|
||||
res=($(find $1 -print | sed "s/${1//\//\\/}\///" | grep -i "\.z\?sh$"))
|
||||
res=($(find $dir -print | sed "s/${dir//\//\\/}\///" | grep -i "\.z\?sh$" | sed -E 's/\.z?sh//g'))
|
||||
|
||||
for i in $res; do
|
||||
out+=("$i")
|
||||
|
||||
18
completions/_srcp
Executable file
18
completions/_srcp
Executable file
@@ -0,0 +1,18 @@
|
||||
#compdef prc sprc
|
||||
dfpath="$(wd path df)"
|
||||
|
||||
out=()
|
||||
|
||||
__read_dir() {
|
||||
dir="$1"
|
||||
res=($(find $dir -print | sed "s/${dir//\//\\/}\///" | grep -i "\.z\?sh$" | sed -E 's/\.plugin\.z?sh//g'))
|
||||
|
||||
for i in $res; do
|
||||
out+=("$i")
|
||||
done
|
||||
}
|
||||
|
||||
cd "$dfpath/plugins"
|
||||
__read_dir .
|
||||
|
||||
_describe 'dotfile' out
|
||||
@@ -105,6 +105,8 @@ rc() {
|
||||
|
||||
if [[ -f "$DOTFILES/$1.sh" ]]; then
|
||||
file="$DOTFILES/$1.sh"
|
||||
elif [[ -f "$DOTFILES/$1.zsh" ]]; then
|
||||
file="$DOTFILES/$1.zsh"
|
||||
else
|
||||
file="$DOTFILES/$1"
|
||||
fi
|
||||
@@ -169,8 +171,14 @@ src() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# same as rc, but for plugin files
|
||||
prc() {
|
||||
rc "plugins/$1.plugin"
|
||||
return $?
|
||||
}
|
||||
|
||||
# same as src, but for plugin files
|
||||
srcp() {
|
||||
sprc() {
|
||||
src "plugins/$1.plugin"
|
||||
return $?
|
||||
}
|
||||
@@ -362,6 +370,7 @@ autoload _docker-exec
|
||||
autoload _docker-volume-path
|
||||
autoload _prj
|
||||
autoload _src
|
||||
autoload _srcp
|
||||
|
||||
# reload entire shell
|
||||
reload-zsh() {
|
||||
|
||||
Reference in New Issue
Block a user