#! /bin/zsh # # this file: # http://user.it.uu.se/~embe8573/conf/.zsh/find-command # https://dataswamp.org/~incal/conf/.zsh/find-command # # works with `find-command' in: # https://dataswamp.org/~incal/emacs-init/ide/find-command.el find-zsh-command () { local string=$1 local search search=$(\grep --exclude-dir="*" -e "^alias $string=\|^$string\ *()" ~/.zsh{rc,env,/(.*|*)}(N) | cut -d ':' -f 1 | sort -u) if [[ ! -z $search ]]; then echo-with-color green "${search/$HOME/~}" store-file-path $search store-search-string $string fi } store-search-string () { local string=$1 echo -n $string > $COMMAND_STR_FILE } store-file-path () { local file=$1 if [[ -f $file ]]; then local filepath=$(readlink -f $file) echo -n $filepath > $COMMAND_FILE else no-file-msg $file fi } alias l=store-file-path