How could I encode space in .vimrc? This is required here:

set list
set listchars=tab:→\ ,

As you see, I use comma to workaround this issue, but I want something like

set list
set listchars=tab:→{U+0020}

The solution is to just use a literal space.

Simply use execute:

execute 'set listchars=tab:> '

Or, as Christian Brabandt points out in the comments:

Alternatively, you can use let &listchars="tab:>\u0020", see :h expr-quote

Note that unicode sequences may be entered via <C-v> if it is followed by a 0, x, or other specifiers (they determine the « format » of the following code).

  • 2
    Alternatively, you can use let &listchars="tab:>\u0020", see :h expr-quote Feb 1 '19 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.