How to show tab character while using expandtab setting in vim
In my .gvimrc
I have following lines:
set listchars=tab:\.\ ,trail:-
set softtabstop=2
set shiftwidth=2
set tabstop=2
set expandtab
When I change last line to set noexpandtab
the indents开发者_StackOverflow社区 can be seen and marked with .
Is there a way to make vim treat expanded tabs like "normal" tab so that list
option works as expected?
The list option does work as expected. It displays tab characters according to the tab setting of 'listchars'
. It sounds like you're conflating "tab" with "indentation level". No, 'list'
isn't designed to distinctly mark the different indentation levels.
You can not see them because tabs are converted to spaces.
You can convert spaces to tabs by issuing :retab!
The standard vim options involving those characters will not do the trick with expandtab set. You will either have to deal with not marking expanded tabs, use real tabs, or do some hacking!
As far as I can see, you would like to highlight indentation. It is possible to achieve that using match highlighting. Please, take a look at my answer to the question regarding indentation guides emulation.
精彩评论