Since I have :set list
in Vim, I often see strange ^I
characters in the beginning of some C-files. Are these the listchars for tabs or what do they mean? How can I transfer that back to normal? I just want to see end-of-line characters.
^M happens to be the way vim displays 0xD (0x0D = 13, M is the 13th letter in the English alphabet). You can remove all the ^M characters by running the following: :%s/^M//g.
They're tabs. By default, VIM shows all control characers other than EOL as ^n
where n
is the character of the alphabet corresponding to the character being shown (tab = char #9, I
= 9th char in alphabet). To stop showing them, use :set nolist
, but that will turn off EOL display as well.
If you want to see end-of-line chars but not tabs, you can use listchars
for that. Use :help listchars
for details, but roughly:
:set listchars=tab:\ \ ,eol:$
That says, when showing tabs, show a space for the first virtual space it occupies and a space for the subsequent ones; when showing EOLs, use a $
. (Since tabs can span multiple virtual columns, you get to use two different chars, one for the first column, and one for the others.)
In addition to T.J. Crowder's answer, another option would be to make the tabs more pleasing to the eye:
set listchars=tab:▸\ ,eol:¬
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With