" This shows spaces and tabs characters. Visual Whitespace.
set listchars=tab:»·,trail:·
set list
--------

That all work well and good, but I would like to disable this
display of visual white space temporarily, do something, and
then reset it back to what I had. Is there a way to do this?

Well, there are a number of possible solutions. The 'listchars' setting only allows for showing trailing whitespace. If this is what you're looking for, you can do something like

        set listchars+=trail:_

do your thing, and then

        set listchars-=trail:_

to undo it.

If you want to visualize all your whitespace, you can do it with

1) search highlighting (to get cleared on your next search):

        :set hls
        /\s

and then optionally reset with

        :set nohls

or

        :noh


2) match highlighting (to optionally be used in complement to search highlighting):

        :match SpellBad /\s/

and then reset with

        :match NONE

3) or you can do it by substituting all of your white-space with some visual character:

        :%s/\s/#/g

and then just undoing with "u" as usual.

Just a few ideas...

-tkc



Reply via email to