views:

169

answers:

2

I'm trying to get vim to display my tabs as so they cannot be mistaken for actual characters. I'd hoped the following would work:

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

However, this gives me

E474: Invalid argument: lcs=tab:⇥

The file is UTF-8 encoded and includes a BOM.

Googling "vim encoding" or similar gives me many results about the encoding of edited files, but nothing about the encoding of executed scripts. How to get this character into my .vimrc so that it is properly displayed?

+6  A: 

The tab setting requires two characters. From :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.

Something like :set lcs=tab:⇥- works but kind of defeats your purpose as it results in tabs that look like ⇥--- instead of ---⇥ which I'm assuming is probably what you wanted.

Randy Morris
Oh hey! I put a space after that, and apparently *that* was the character vim complained about. Somehow it didn't occur to me to check... I got what I wanted (`⇥ `) by copying and pasting an "en space" (U+2002) after the tab character.
Thomas
@Thomas - You can use a regular space character if you escape it: `tab:⇥\ `
Randy Morris
A: 

Try:

set lcs=tab:⇥\

Make certain to put a space after the '\' so you can escape the space.