gpt4 book ai didi

unicode - 如何在 vim 脚本中使用 Unicode 字符?

转载 作者:行者123 更新时间:2023-12-02 06:24:41 28 4
gpt4 key购买 nike

我正在尝试让 vim 将我的标签显示为 ,这样它们就不会被误认为是实际字符。我希望以下方法可行:

if has("multi_byte")
set lcs=tab:⇥
else
set lcs=tab:>-
endif

但是,这给了我

E474: Invalid argument: lcs=tab:⇥

文件采用 UTF-8 编码并包含 BOM。

谷歌搜索“vim 编码”或类似的东西给了我很多关于编辑文件编码的结果,但没有关于执行脚本的编码。如何将此字符放入我的 .vimrc 中以便正确显示?

最佳答案

制表符设置需要两个字符。来自 :help listchars:

  tab:xy    Two characters to be used to show a tab.  The first
char is used once. The second char is repeated to
fill the space that the tab normally occupies.
"tab:>-" will show a tab that takes four spaces as
">---". When omitted, a tab is show as ^I.

:set lcs=tab:⇥- 这样的东西可以工作,但有点违背你的目的,因为它会导致标签看起来像 ⇥--- 而不是 ---⇥ 我假设这可能是您想要的。

关于unicode - 如何在 vim 脚本中使用 Unicode 字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2805399/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com