VIM PRINT WHITESPACE CHARACTERS SET LIST and NO LIST
####################################################

Info from: http://stackoverflow.com/questions/1675688/make-vim-show-all-white-spaces-as-a-character

When programming in python via vi or vim its important to know where you have those pesky tabs so that you get rid of them. You want your 4 space indentation done with spaces instead of tabs. So its nice to see where the tabs are to get rid of them.

To see Tabs/WhiteSpace etc in VIM/VI

In Normal Mode (none insert mode)

To enable:

:set list

Note: that is alike to running “cat -A yourtextfile“. The -A in cat will print newlines as $ and tabs as ^I. Read below for another interesting way to find tabs in text.

To make tabs more human friendly (instead of just ^I):

:set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<

To disable:

:set nolist

Find Tabs in Text files

This is also useful in finding tabs in files (without using VI or VIM)

Its not often that we ever see the use of the following two characters side by side ^I So its quiet awesome

cat -A somefile | grep "\^I"

Each ^I is a tab (which might look like 2,4 or 8 spaces depending on the program your using for viewing)

Leave a Reply

Your email address will not be published. Required fields are marked *