How can I make vim show spaces?

While you can't do exactly what you want here, if your reasoning is like mine, you're wanting to see those spaces because it helps verify proper indentation (do I have 2 spaces there, or is it 3?). For Vim >= 7.3, you can use the indentLine plugin to add a marker at each indentation. It's awesome.

To install if you're using Pathogen:

cd ~/.vim/bundle
git clone https://github.com/Yggdroot/indentLine

enter image description here


There are times when I absolutely need to see which whitespaces are tabs and which are true space characters, as well as when spaces appear at the end of a line.

When I'm using vim, I use:

:set list

(which I can turn off with :set nolist)

With :set list, literal spaces show up as spaces, tabs show up as ^I, and the end-of-line shows up as a bright-pink $. (So any blank space you see to the left of the pink $ you'll know is a true space character, and the blank spaces to the right of it is just the "nothing" between the end-of-line and the right side of the editor.)

It's ugly, but it works well.

I don't recommend using it all the time -- just those times when it is crucial to see where literal spaces and literal tab characters exist.


Show non-space whitespace with

set list

Additionally show spaces as . with

set lcs+=space:·

Turn it off with

set nolist

Tags:

Vim