In ruby, since it's utf-8 encoded in the system wide. so it's pretty straight forward:
string = "\u7f51\u5740\u4e0d\u80fd\u4e3a\u7a7a"
=>网址不能为空
Anyone can I tell me that how to do this in vim?
In ruby, since it's utf-8 encoded in the system wide. so it's pretty straight forward:
string = "\u7f51\u5740\u4e0d\u80fd\u4e3a\u7a7a"
=>网址不能为空
Anyone can I tell me that how to do this in vim?
If you are wanting to insert Unicode characters, see the
utf-8-typing
help.For example, Ctrl-V
u7f51
will insert 网.If you are wanting it in Vim scripts, you can use Unicode escapes in the same way as in Ruby; the command
echo "\u7f51\u5740\u4e0d\u80fd\u4e3a\u7a7a"
will echo the string you provide in your question.Being aware of this, Ctrl-R comes into play, with the
"
and=
registers; see the docs fori_CTRL-R
andi_CTRL-R_=
for more info.Given the following, with the cursor inside the double-quoted string:
Apply these keystrokes: ci"Ctrl-R="Ctrl-R""EnterEsc
This will turn it into the following:
Try to figure out how it works yourself, but I'll explain more if you can't figure it out.