Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

meaning of ^I in vim and how to not show them?

Tags:

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.

like image 753
erikbstack Avatar asked Jul 16 '12 13:07

erikbstack


People also ask

What does m stand for in vim?

^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.


2 Answers

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.)

like image 177
T.J. Crowder Avatar answered Sep 21 '22 12:09

T.J. Crowder


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:¬ 
like image 24
Conner Avatar answered Sep 20 '22 12:09

Conner