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

Vivek Kumar
  • 4,822
  • 8
  • 51
  • 85
  • 3
    Single spaces can't really be made visible with Vim. Check out the answers and workarounds [here](http://stackoverflow.com/questions/1675688/make-vim-show-all-white-spaces-as-a-character). – glts Oct 10 '12 at 08: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 Jun 07 '18 at 22:23

2 Answers2

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.

shinkou
  • 5,138
  • 1
  • 22
  • 32
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:»
wisbucky
  • 33,218
  • 10
  • 150
  • 101
  • Could you tell me which font I should use to print `•` ? It is broken for me as you see [here](https://i.redd.it/ez53d0o54hf31.png). – Arup Rakshit Aug 11 '19 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 https://en.wikipedia.org/wiki/List_of_Unicode_characters to find any character you like. You can also use a [unicode converter](https://www.branah.com/unicode-converter) to copy and paste a character to lookup its code. – wisbucky Aug 12 '19 at 22:43