3

So, I got it that Vim has no option to display all characters (including whitespace and CR and LF distinctly)

I already saw the question How to Display Hidden Characters in vim? and others on stackexchange.

Is there at least a plugin to do that? I wasn't able to find any.



EDIT:

I found out (from this comment) that recent versions of Vim (since patch 7.4.710) have a space option of listchars.
The dot . is quite good for it, but you can also use unicode characters such as the middle dot ·.
That solves perfectly the problem with whitespace, so there's no need of a plugin for that.
The problems with line terminators still stand though, and there might be no way to fix them...

Martin Tournoij
  • 62,054
  • 25
  • 192
  • 271
gbr
  • 139
  • 1
  • 5
  • 5
    Your link has an accepted answer (set list), what's wrong with it? – VanLaser May 04 '16 at 09:33
  • Also see https://superuser.com/questions/463785/how-do-i-get-vim-to-show-trailing-whitespace-but-use-blank-spaces-for-tabs. – PhilippFrank May 04 '16 at 10:03
  • @VanLaser With that inner spaces can't be clearly distinguished (for example with a colored middle dot as several editors do) and CR and LF can be told apart only if a file has mixed line endings, and even then there's no way to tell if there's a LF at the end of the file or not (there's always a single "$" displayed), and "$" also means either LF in an all-LF file or CRLF in an all-CRLF file. – gbr May 04 '16 at 10:06
  • @PhilippFrank I already read it, doesn't help. – gbr May 04 '16 at 10:07
  • 3
    About inner spaces: they are not different characters, right? They are still "normal" spaces - for that you can add a 'match' rule if I'm not mistaken. For the 2nd issue - again, you can add matches that parse your file and syntax highlight the line for example, if it ends in a different "Enter" than you wish. Just to suggest a different approach, maybe it can help. – VanLaser May 04 '16 at 10:09
  • 1
    @gbr What do you mean it doesn't help? It did work when I tried it, if I did not misunderstand your intention. (e) Ah ok, your intention goes beyond what list does/can do, so maybe you should try VanLaser's suggestion. – PhilippFrank May 04 '16 at 10:48
  • @VanLaser With :match you can only highlight things, if I'm not mistaken; having spaces of a different color doesn't help in any way, I want to tell apart one character from the other, a continuous stripe of color is no better than a continuous stripe of white. For the 2nd, I just want to see clearly all the characters, I don't want to have to remember to check what options are set for the current file ('fileformat', 'eol'...), and preferably not to launch scripts either. The characters are there, I want to see them. – gbr May 04 '16 at 11:01
  • I want to know what I (or my editor) put in a file, and I can't constantly switch to another software. If there's no way this will be a major reason for me to ditch vim. – gbr May 04 '16 at 11:01
  • You can ditch Vim any time for all we care but you can also make your question easier to understand with a visual example. What we understand from your question is that you want to see an a when you insert an a or a when you insert a space. – romainl May 04 '16 at 11:55
  • @romainl Oh come on it's a standard feature. I'm pretty sure that a person aware of a plugin who does it would understand the question right away – gbr May 04 '16 at 12:35
  • Again, is an "inner space" a different character than "space", or not? – VanLaser May 04 '16 at 12:43
  • 1
    @VanLaser I'm sorry, I remarked inner space because the listchar option does allow to set a character for trailing spaces, and I mistakenly understood that it also permitted to set one for space at the beginning of the lines, with precedes. Thus I thought that the only space it didn't cover was the "inner" space, that is that interior to the lines. I now saw that precedes has nothing to do with it though (so it's even more limited). I don't want to treat "inner" space differently, I'd like that all spaces be displayed with a different symbol. – gbr May 04 '16 at 13:12
  • @VanLaser I noticed that at least in the GUI version you can set a specific font for an highlight group, so I think I could theoretically do what I want for the spaces with your solution, by making a font with my chosen symbol. However it's not that straightforward, I was looking for a ready solution (especially one that addresses the line endings too). – gbr May 04 '16 at 13:32
  • @VanLaser I found out that recent versions support a complete solution for whitespace, see the edit – gbr May 05 '16 at 17:57
  • Great. FWIW, when I open a DOS-type line-terminated file in Vim, it does show a differently-colored ^M at the end of the line - but that probably depends on the file encoding settings. Perhaps try playing with dos2unix and unix2dos Linux commands on a dummy file, loading it into Vim, and see how it behaves. – VanLaser May 05 '16 at 18:28
  • @VanLaser Yes it varies with the fileformat settings, as I said in the first comment – gbr May 05 '16 at 18:32
  • Line breaks are obvious. Put &ff in your status line if you want to know what it is. – Antony Jun 12 '16 at 11:08
  • Vim displays characters in fixed width cells. How are you having trouble spotting spaces? – Antony Jun 12 '16 at 11:12

0 Answers0