config/shell: adjust completions & add edcomp

This commit is contained in:
xeruf 2021-06-24 22:08:32 +02:00
parent d00dd95668
commit 7b4696b3a6
4 changed files with 16 additions and 1 deletions

View File

@ -32,6 +32,7 @@ yas() {
cmd="yay -S --nobatchinstall $pkg"
print -s "$cmd"
eval "$cmd"
rehash
fi
}
yar() {

View File

@ -78,6 +78,13 @@ edconf() {
CONFIG_SHELL_FUNCTIONS="${BASH_SOURCE[0]:-${(%):-%x}}"
alias r="reset && exec zsh"
edcomp() {
file=$(echo "$1" | sed 's/^\([^_]\)/_\1/')
$EDITOR "${fpath[-1]}/$file"
unfunction "$file" && compinit
}
compdef "_files -W ${fpath[-1]}/" edcomp
edshell() {
case $1 in
("") file="$CONFIG_SHELL_FUNCTIONS";;

View File

@ -1,2 +1,4 @@
#compdef edbin
compadd $(ls -pA $HOME/.local/bin/scripts) #$(echo $PATH | cut -d':' -f1 | xargs ls -pA)
_files -W $HOME/.local/bin/scripts
#compadd $(ls --almost-all --indicator-style=slash $HOME/.local/bin/scripts)
#$(echo $PATH | cut -d':' -f1 | xargs ls -pA)

View File

@ -0,0 +1,5 @@
#compdef yc
compadd $(git diff-index HEAD --name-only --relative=${XDG_CONFIG_HOME/$HOME\/}/)
#_files -W $XDG_CONFIG_HOME -g "git*"
# xargs _files -W $XDG_CONFIG_HOME -g
# yadm diff HEAD --name-only -- $XDG_CONFIG_HOME