How to show tab character when using expandtab parameter in vim

In my .gvimrc , I have the following lines:

 set listchars=tab:\.\ ,trail:- set softtabstop=2 set shiftwidth=2 set tabstop=2 set expandtab 

When I change the last line to set noexpandtab , the indentation is visible and marked with a sign .

Is there a way to get vim to handle advanced tabs, such as the "normal" tab, so that the list option works as expected?

+4
source share
4 answers

The list option works as expected. It displays tabs according to the setting of the 'listchars' tab. It looks like you are combining the “tab” with the “indentation level”. No, 'list' not intended to clearly indicate different levels of indentation.

+2
source

You cannot see them because tabs are converted to spaces. You can convert spaces to tabs by issuing :retab!

+1
source

As far as I can see, you would like to highlight the indentation. This is possible using matching highlighting. Please take a look at the question about guiding indentation emulation.

+1
source

The standard vim parameters containing these characters will not use the expandtab set trick. You will either have to not mark advanced tabs, use real tabs, or do some hacks!

+1
source

Source: https://habr.com/ru/post/1309108/


All Articles