Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I display <TAB> as bars in vim

Tags:

vim

vi

I want to know is it possible to display the <tab> as | (bars) when coding in vim like this image Are there any ways to show them.

Please any solution other than set listchars and set list as it affects eol and spaces.

like image 587
Sabrina Avatar asked Dec 18 '16 08:12

Sabrina


1 Answers

:set list
:set lcs=tab:\|\  " the last character is space!

The tab setting consists of two characters: | and a space. The first character is used once. The second character is repeated to fill the space that the tab normally occupies. See :h lcs.

Sample result:

enter image description here

However, setting the second character to space is not very helpful, as it is difficult to distinguish spaces followed by a tab, for instance. Consider changing it to another character, e.g.:

:set list listchars=tab:\|\-

Sample result:

enter image description here

like image 86
Ruslan Osmanov Avatar answered Oct 15 '22 08:10

Ruslan Osmanov