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

Tho*_*mas 2 unicode vim

我试图让vim显示我的标签,?因此他们不能被误认为是真正的角色.我希望以下方法有效:

if has("multi_byte")
    set lcs=tab:? 
else
    set lcs=tab:>-
endif
Run Code Online (Sandbox Code Playgroud)

但是,这给了我

E474: Invalid argument: lcs=tab:?
Run Code Online (Sandbox Code Playgroud)

该文件采用UTF-8编码,并包含BOM.

谷歌搜索"vim编码"或类似的给我很多关于编辑文件的编码的结果,但没有关于执行脚本的编码.如何将这个角色放入我的.vimrc以便正确显示?

Ran*_*ris 8

选项卡设置需要两个字符.来自: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.
Run Code Online (Sandbox Code Playgroud)

喜欢的东西:set lcs=tab:?-的作品,但那种违背了你的目的,因为它导致的标签,看起来像?---,而不是---?它,我假设可能是你想要的.

  • @Thomas - 你可以使用常规空格字符:`tab:⇥\` (4认同)