Created
November 14, 2017 01:01
-
-
Save astrsk-hori/43babb832a99b350fc97981a6473e730 to your computer and use it in GitHub Desktop.
aliasを展開するzshコマンド
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my-open-alias() { | |
if [ -z "$RBUFFER" ] ; then | |
my-open-alias-aux | |
else | |
zle end-of-line | |
fi | |
} | |
my-open-alias-aux() { | |
str=${LBUFFER%% } | |
bp=$str | |
str=${str##* } | |
bp=${bp%%${str}} | |
targets=`alias ${str}` | |
if [ $targets ]; then | |
cmd=`echo $targets|cut -d"=" -f2` | |
LBUFFER=$bp${cmd//\'/} | |
fi | |
} | |
zle -N my-open-alias | |
bindkey "^ " my-open-alias |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment