Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Vim中使用UTF-8序列键入Unicode字符?_Vim_Unicode - Fatal编程技术网

如何在Vim中使用UTF-8序列键入Unicode字符?

如何在Vim中使用UTF-8序列键入Unicode字符?,vim,unicode,Vim,Unicode,₩是朝鲜的货币符号。其Unicode编码点为U+20a9 在插入模式下,我可以按Ctrl-Vu20a9来键入它。 如果我只知道它的UTF-8格式e2 82 a9,我怎么能轻松地键入它呢?我刚刚找到了这个解决方案: 在插入模式下,按Ctrl-R=“\xe2\x82\xa9”Enter键 不过,我想知道任何其他(较短的?)方法。同样的解决方案,通过自动化来帮助记住它: command! -nargs=* UTF8 call EncodeUTF8(<f-args>) fun! Encode

是朝鲜的货币符号。其Unicode编码点为
U+20a9

在插入模式下,我可以按Ctrl-V
u20a9
来键入它。

如果我只知道它的UTF-8格式
e2 82 a9
,我怎么能轻松地键入它呢?

我刚刚找到了这个解决方案:

在插入模式下,按Ctrl-R
=“\xe2\x82\xa9”
Enter键


不过,我想知道任何其他(较短的?)方法。

同样的解决方案,通过自动化来帮助记住它:

command! -nargs=* UTF8 call EncodeUTF8(<f-args>)
fun! EncodeUTF8(...)
   let utf8str = ""
   for i in a:000
      let utf8str .= "\\x" . i
   endfor
   exe "norm i" . eval("\"".utf8str."\"")
endfun
命令-nargs=*UTF8调用编码UTF8()
有趣!EncodeUTF8(…)
让utf8str=“”
因为我在a:000
让utf8str=“\\x”。我
外循环
exe“标准i”。eval(“\”.utf8str.\”)
结束
现在您可以
:UTF8 e2 82 a9

您还可以使用
W=
键入此特定字符。请参阅
:帮助有向图表mbyte

请注意,您还可以在正常模式下使用
ga
g8
获取有关字符的信息。因此,只需执行一次
=“\xe2\x82\xa9”
,然后执行
ga
来获取代码点可能会更容易