I can change the eol character of all lines except the active one by

hi nonText ctermfg=2

However, I do not know how to change the eol character of the line where my cursor is.

How can you highlight the eol character of an active line?


EOL characters are under the NonText highlighting group. However, the ones on the current line conform to the Normal and Cursorline group, if you have CursorLine turned on. If you don't, there's no problem, EOL goes with the NonText group. If you do, you can modify CursorLine group, but not much, cause you'll be changing the entire current line highlighting.

  • 1
    +1 cos this sounds about right and should answer the question (at least explain why it can't be done) – David Pashley Jun 7 '09 at 7:41

I'm not sure how to answer your question -- I don't think control characters like that can be highlighted.

I do know that they can be search-and-replaced easily. In the case of the ^M EOL character, I usually use :%s/ctrl-Vctrl-M//g

  • -1 because this doesn't answer the question. Useful, yes, relevent, not so much. – David Pashley Jun 7 '09 at 7:42

If you simply want to see the eol character use the following command:

:set list

This will show tabs and eol characters. The default character representation for eol is the '$' character. This can be changed with the 'lcs' command if you want. To turn this off simply use the command:

:set nolist

Also, if you want to read more about this command you need to type:

:help nolist

The 'set list' command shows the eol character on all lines, i.e. the active and non-active lines both in control and in editing modes.

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.