I have normally set up my listchars to make tab characters and trailing spaces visible. In my ~/.vim/vimrc I have:

set listchars=tab:»\ ,trail:·

Now there are certain file types where tabs are common and I just want to display them using spaces, so I put the following in the corresponding ftplugin file:

setlocal listchars=tab:\ \ ,trail:·

The problem is when I have splits with two different file types open, it seems that despite using setlocal, tabs are not visible anymore for all open files, not just the one with the custom file type.

I don't want to setlocal nolist (here setlocal seems to do what I expect) for the custom file type, because I still want to see trailing spaces.

How can I achieve different listchars per split pane? (Or something equivalent without using listchars?)

  • 3
    According to the help, listchars is global. You’d have to toggle it on BufEnter conditionally by filetype – D. Ben Knoble Mar 2 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.