1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-28 05:00:59 +01:00

22014: argument-base, insert-unicode-char

This commit is contained in:
Peter Stephenson 2005-11-24 10:25:33 +00:00
parent 325a7c0417
commit e66af50a98
9 changed files with 133 additions and 16 deletions

View file

@ -0,0 +1,17 @@
# Make hex integers appear as 0x...
setopt localoptions cbases
if [[ $LASTWIDGET = insert-unicode-char ]]; then
# Second call; we should have a usable prefix.
# If we don't, give up.
(( ${+NUMERIC} )) || return 1
# Convert it back to hex, padded with zeroes to 8 digits plus the 0x...
local -i 16 -Z 10 arg=$NUMERIC
# ...and use print to turn this into a Unicode character.
LBUFFER+="$(print -n "\U${arg##0x}")"
else
# Set the base to 16...
zle argument-base 16
# ...wait for user to type hex keys then call this widget again.
zle universal-argument
fi