0

I have no idea how did I suddenly get ^I characters in my source code file.

Everywhere I had a space ( but only in the beginning of the line ) , it shows up as ^I. This is making my code very very unreadable.

I am using vim as an editor.

Can anyone tell me what could have led this to happen and how can I replace them again with an invisible blank space?

3

^I (Ctrl-I) is a representation of the tab character (9 in ASCII). Usually, Vim displays tab characters by the number of space characters as specified in the tabstop option. However, setting the list option, displays various unprintable characters and one of its effects is to display Tab as a control character. To check if this option is set, you can run :set list? (and set listchars?).

To replace the tab characters with spaces, run :%s/^I/ /g. The ^I control character can be obtained by typing Ctrl-V followed by Tab.

  • 1
    Indeed set list was in my .vimrc. No need to find and replace. Simply removing the entry from the file helped. – infoclogged Mar 23 '17 at 17:09
0

One can replace them with an regex in VIM.

:%s/[\x09]/ /gc

check if there is an entry

set list

in the .vimrc file. Hint taken from the accepted answer.

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.