We help IT Professionals succeed at work.

Why don't I see space character in the file opened in vim editor?

naseeam
naseeam asked
on
I have specified underscore ( _ ) character to show for space.  :set listchars=eol:$,nbsp:_,tab:>-,trail:~,extends:>,precedes:<

In file opened in vim,
I see end of line character as $
I see tab character as >-
but I don't see underscore space character

 50 addtask listtasks$
 51 do_listtasks[nostamp] = "1"$
 52 python do_listtasks() {$
 53 >-import sys$
 54   print('Hello World')$
 55 >-for e in bb.data.keys(d):$
 56 >->-if d.getVarFlag(e, 'task', False):$
 57 >->->-bb.plain("%s" % e)$
 58 }$

Open in new window


I changed my background from Black to White but I still don't see space character?
Comment
Watch Question

Hi,

I think your line space that has been messed up.

Hit <Esc> and enter:

:set linespace=5

Open in new window

This will set the line space to 5.

Cheers

Author

Commented:
I entered above command and seems like nothing happened.

What is linespace ?
nociSoftware Engineer
Distinguished Expert 2019

Commented:
You can view  the tabs though.
Tabs can be made visible.
Use:

:set listchars
:set list

See also:
https://vim.fandom.com/wiki/See_the_tabs_in_your_file

Author

Commented:
>> You can view  the tabs though.
I'm already viewing tabs.  Please see my original question.  tab is displayed by character >-
Software Engineer
Distinguished Expert 2019
Commented:
A space IS  shown  as a empty part.   By default Tabs are getting hidden (replaced by 1..n spaces) depending on tab size/tab stop settings.

A quick check for tabs in vi can be done by:   %l in command mode. (tabs are shown as >, end of line as $)
Your line 54 has 2 leading spaces. , there is a space after python... addtask..., import..., for..., e... in ...
_ (underscore) is used as a regular character in identifiers/names, so suing it for something else will cause confusion.

Author

Commented:
Great solution!  Thank you!

Author

Commented:
Very good explanation.  Quick response.  Great solution!