summaryrefslogtreecommitdiffstats
path: root/zsh/oh-my-zsh/plugins/alias-finder/alias-finder.plugin.zsh
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-03-25 16:43:09 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-03-25 16:43:09 +0530
commita62114c91f2070c8c8453d117f3d81dc113e41ff (patch)
treef266e87af29a08c01f82bc32dd7d463d8ec4441a /zsh/oh-my-zsh/plugins/alias-finder/alias-finder.plugin.zsh
parentaf120ab348f2e1a5a39dec035ed9dcf84189a64e (diff)
downloaddotfiles-a62114c91f2070c8c8453d117f3d81dc113e41ff.tar.gz
dotfiles-a62114c91f2070c8c8453d117f3d81dc113e41ff.tar.bz2
dotfiles-a62114c91f2070c8c8453d117f3d81dc113e41ff.zip
dotfile update
Diffstat (limited to 'zsh/oh-my-zsh/plugins/alias-finder/alias-finder.plugin.zsh')
-rw-r--r--zsh/oh-my-zsh/plugins/alias-finder/alias-finder.plugin.zsh47
1 files changed, 0 insertions, 47 deletions
diff --git a/zsh/oh-my-zsh/plugins/alias-finder/alias-finder.plugin.zsh b/zsh/oh-my-zsh/plugins/alias-finder/alias-finder.plugin.zsh
deleted file mode 100644
index caee9b5..0000000
--- a/zsh/oh-my-zsh/plugins/alias-finder/alias-finder.plugin.zsh
+++ /dev/null
@@ -1,47 +0,0 @@
-alias-finder() {
- local cmd="" exact="" longer="" wordStart="" wordEnd="" multiWordEnd=""
- for i in $@; do
- case $i in
- -e|--exact) exact=true;;
- -l|--longer) longer=true;;
- *)
- if [[ -z $cmd ]]; then
- cmd=$i
- else
- cmd="$cmd $i"
- fi
- ;;
- esac
- done
- cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep
- if (( $(wc -l <<< $cmd) == 1 )); then
- while [[ $cmd != "" ]]; do
- if [[ $longer = true ]]; then
- wordStart="'{0,1}"
- else
- wordEnd="$"
- multiWordEnd="'$"
- fi
- if [[ $cmd == *" "* ]]; then
- local finder="'$cmd$multiWordEnd"
- else
- local finder=$wordStart$cmd$wordEnd
- fi
- alias | grep -E "=$finder"
- if [[ $exact = true || $longer = true ]]; then
- break
- else
- cmd=$(sed -E 's/ {0,1}[^ ]*$//' <<< $cmd) # removes last word
- fi
- done
- fi
-}
-
-preexec_alias-finder() {
- if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
- alias-finder $1
- fi
-}
-
-autoload -U add-zsh-hook
-add-zsh-hook preexec preexec_alias-finder