3

Searching for a solution to show hidden characters, I found the example,

:set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<
:set list

What are extends and precedes?

I expected a file to have only tabs, but these options show some spaces as > rather than >-.

How to Display Hidden Characters in vim?

  • I wanted to use hidden-characters for a tag, but it's not there and I'm not 150 reputation (>_<) – xtian Mar 9 '18 at 23:12
5

Extends and Precedes are used when you don't have line wrapping on, to show that there is more text to the left or right of the line.

In a wide window, I might have

|This is a long line of text.$      |

With extends and precedes set as you have, and shrinking the terminal a lot with the cursor at the beginning of the line (and :set nowrap):

|This is a long li>|

Hitting $ will show the precedes as expected:

|<e of text.$      |

Moving to the middle:

|<long line of tex>|

(you can read more in the documentation for listchars, see :help 'listchars'):

As to seeing '>' instead of '>-' or '>---' for tabs, depending on where you are, a tab stop one character away from where the tab character is would result in a single character shown. Inserting a tab at the beginning (and wider window):

|>---This is a long line of text.$   |

adding 'ab'

|ab>-This is a long line of text.$   |

Adding 'c'

|abc>This is a long line of text.$   |

The '>' in this case always shows where the tab character is, and the '-' shows what additional columns were skipped to reach the tab stop, if any.

  • 1
    Ah! The display of > instead of >- is the tab stop. It just so happens the example I used also has extends with >. They display the same, but they're not the same found listchar. – xtian Mar 10 '18 at 18:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.