Skip to content

Commit 02b8f7f

Browse files
committed
Initial commit of code
1 parent 43fd7cc commit 02b8f7f

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
print-alias
2+
===========
3+
4+
This prints aliases.

print-alias.plugin.zsh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
local -r ALIAS_FORMAT=$'\e[36m'
2+
local -r NON_ALIAS_FORMAT=$'\e[2m'
3+
local -r RESET_COLORS=$'\e[0m'
4+
5+
_print-alias-accept-line () {
6+
emulate -L zsh
7+
local -a words
8+
words=( ${(z)BUFFER} )
9+
local -r first_word=${words[1]}
10+
if [[ "$(whence -w $first_word 2>/dev/null)" == "${first_word}: alias" ]]; then
11+
shift words
12+
echo -nE $'\n'"${ALIAS_FORMAT}$(whence $first_word)${RESET_COLORS}"
13+
for word in $words; do
14+
echo -nE " ${NON_ALIAS_FORMAT}${word}${RESET_COLORS}"
15+
done
16+
fi
17+
zle .accept-line
18+
}
19+
20+
zle -N accept-line _print-alias-accept-line

0 commit comments

Comments
 (0)