Provide shortcut to find personal bin exes
This commit is contained in:
parent
686a06e2b6
commit
662063f37b
5 changed files with 43 additions and 3 deletions
|
@ -36,7 +36,7 @@ fi
|
|||
|
||||
autoload compinit -Uz
|
||||
setopt EXTENDEDGLOB
|
||||
if [[ -n ${ZDOTDIR}/.zcompdump(#qN.mh+24) ]]; then
|
||||
if [[ -n ${ZDOTDIR}/.zcompdump(#qN.m+1) ]]; then
|
||||
compinit
|
||||
else
|
||||
compinit -C
|
||||
|
|
6
zsh/.config/zsh/completions/_comma
Executable file
6
zsh/.config/zsh/completions/_comma
Executable file
|
@ -0,0 +1,6 @@
|
|||
#compdef ,
|
||||
|
||||
found_bin_dir=$(find-local-bin aet)
|
||||
|
||||
_files -g "^," -W $found_bin_dir
|
||||
_files -g "^," -W $HOME/bin
|
|
@ -25,6 +25,25 @@ function docker-compose-call {
|
|||
fi
|
||||
}
|
||||
|
||||
function find-local-bin {
|
||||
local prefix=$1
|
||||
local bin_dir="$prefix-bin"
|
||||
local found_bin_dir=""
|
||||
|
||||
current_dir=$(pwd)
|
||||
found_bin_dir=$current_dir/$bin_dir
|
||||
while [ ! -d $found_bin_dir ]; do
|
||||
if [[ $current_dir == $HOME ]]; then
|
||||
break
|
||||
fi
|
||||
|
||||
current_dir=$(realpath "$current_dir/..")
|
||||
found_bin_dir=$current_dir/$bin_dir
|
||||
done
|
||||
|
||||
echo $found_bin_dir
|
||||
}
|
||||
|
||||
function g {
|
||||
if [[ $# > 0 ]]; then
|
||||
git $@
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue