5

I have added set listchars=tab:»\,trail:·,extends:#,nbsp:. for showing invisible characters.

It is working for tab extends but not working for nbsp, I have read the help for :set listchars and tried with examples given there, but still I am not getting dot character for single space character.

what else I have to do for this. Any suggestion.

Thanks

2
  • 3
    Single spaces can't really be made visible with Vim. Check out the answers and workarounds here.
    – glts
    Commented Oct 10, 2012 at 8:15
  • @glts, What does "single space" mean exactly? Does it just mean an ordinary space (x20)? Can't you just do set listchars=space:· and set list?
    – wisbucky
    Commented Jun 7, 2018 at 22:23

2 Answers 2

5

Please be careful with the backslashes.

set listchars=tab:>\\,trail:·,extends:#,nbsp:.

This works as expected. However, one should note that nbsp stands for non-breakable space (character 0xA0). It's different from ordinary whitespaces (character 0x20) and in most cases, we'll have to do Ctrl-v x a 0 in insert mode to type it.

4
  • @shinkou The command to insert a literal no-break space (U+00A0) is CTRL-V xa0 or CTRL-V u00a0.
    – glts
    Commented Oct 10, 2012 at 14:27
  • @gits True, I missed the "x". Thanks. :)
    – shinkou
    Commented Oct 10, 2012 at 16:18
  • @dearvivekkumar Please see gits' comment.
    – shinkou
    Commented Oct 10, 2012 at 16:22
  • Is there some alternative by which I can show for space character(0x20)?? Commented Dec 15, 2012 at 10:55
5

More recent versions of vim can show regular spaces as well. (Confirmed on vim 7.4.1689).

:set list
:set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:»
2
  • Could you tell me which font I should use to print ? It is broken for me as you see here. Commented Aug 11, 2019 at 10:16
  • I'm not sure, it worked for me with the default font. The character in your comment is U+2022 "bullet". You could try · U+00B7 "middle dot" instead. Or scan through en.wikipedia.org/wiki/List_of_Unicode_characters to find any character you like. You can also use a unicode converter to copy and paste a character to lookup its code.
    – wisbucky
    Commented Aug 12, 2019 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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