Show whitespace in vi
Opened a configuration file with vi:
vi /etc/iproute2/rt_tableBy default it looks as follows:
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhepUsing the command set: list enables showing whitespace:
#$
# reserved values$
#$
255^Ilocal$
254^Imain$
253^Idefault$
0^Iunspec$
#$
# local$
#$
#1^Iinr.ruhep$To disable showing whitespace, use set: nolist.
White space characters are rendered in blue, normal characters are white (perhaps counter-intuitively!), except for the normal ASCII space character (0x20), which is still rendered as just a space.
A blue $ indicates a new line character. A blue ^ followed by another character indicates whitespace. For example, ^I indicates tab.
To convert a blue ^* sequence into a white space character, take the character after the ^ and subtract 0o100 from its octal representation. For example, ^I uses I, which is 0o111 in octal. Subtracting 0o100 gives 0o011, which is tab. This is perhaps easlier visualised by looking at an ASCII table: one simply has to find the character in the right two columns, then follow the same row but look left two columns.