summaryrefslogtreecommitdiff
path: root/Functions
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-11-24 10:25:33 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-11-24 10:25:33 +0000
commite66af50a984b9b693fd6bbbf5f806612cdd03b66 (patch)
treef00e013b62fceea6f1eded9f78f846781b983613 /Functions
parent325a7c041715f7602ad55161cf15e14b24f97b97 (diff)
downloadzsh-e66af50a984b9b693fd6bbbf5f806612cdd03b66.tar.gz
zsh-e66af50a984b9b693fd6bbbf5f806612cdd03b66.zip
22014: argument-base, insert-unicode-char
Diffstat (limited to 'Functions')
-rw-r--r--Functions/Zle/.distfiles1
-rw-r--r--Functions/Zle/insert-unicode-char17
2 files changed, 18 insertions, 0 deletions
diff --git a/Functions/Zle/.distfiles b/Functions/Zle/.distfiles
index e6d1cf3d6..5bce7ce04 100644
--- a/Functions/Zle/.distfiles
+++ b/Functions/Zle/.distfiles
@@ -9,6 +9,7 @@ edit-command-line forward-word-match
history-pattern-search history-search-end
incarg incremental-complete-word
insert-composed-char insert-files
+insert-unicode-char
keeper kill-word-match
match-words-by-style narrow-to-region
narrow-to-region-invisible predict-on
diff --git a/Functions/Zle/insert-unicode-char b/Functions/Zle/insert-unicode-char
new file mode 100644
index 000000000..0ffd29418
--- /dev/null
+++ b/Functions/Zle/insert-unicode-char
@@ -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