tvi: print the unicode code point of a character with ga - neatvi - [fork] simp… | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit afd07cde72da1f78aed6b2319b346afe81a63b0a | |
parent 11716debb4eea3eae11502526cc7648c9e8a180f | |
Author: Ali Gholami Rudi <[email protected]> | |
Date: Thu, 21 Apr 2016 16:37:51 +0430 | |
vi: print the unicode code point of a character with ga | |
Diffstat: | |
M vi.c | 12 ++++++++++++ | |
1 file changed, 12 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/vi.c b/vi.c | |
t@@ -973,6 +973,16 @@ static void vc_status(void) | |
ren_cursor(lbuf_get(xb, xrow), col) + 1); | |
} | |
+static void vc_charinfo(void) | |
+{ | |
+ char *c = uc_chr(lbuf_get(xb, xrow), xoff); | |
+ if (c) { | |
+ char cbuf[8] = ""; | |
+ memcpy(cbuf, c, uc_len(c)); | |
+ snprintf(vi_msg, sizeof(vi_msg), "<%s> %04x\n", cbuf, uc_code(… | |
+ } | |
+} | |
+ | |
static int vc_replace(void) | |
{ | |
int cnt = MAX(1, vi_arg1); | |
t@@ -1221,6 +1231,8 @@ static void vi(void) | |
if (k == '~' || k == 'u' || k == 'U') | |
if (!vc_motion(k)) | |
mod = 1; | |
+ if (k == 'a') | |
+ vc_charinfo(); | |
break; | |
case 'x': | |
vi_back(' '); |