All Articles

Tips to Make Vim Shown White Space Characters

vim-lcs

While editing text files with vi/vim, we often need the white space characters to be shown, like ‘\t’ (tabulation), ‘\n’ (end of line), and ’ ‘(space) to confirm the file syntax. How to show these characters in different ways? You may just use the following vim command,

:set list

By default, ‘\t’ is shown as ‘^I’, ‘\n’ is shown as ’$’, and ’ ’ is kept not changed. You may also want to customize the representations, this could be configured via the listchars/lcs option, e.g,

:set lcs=tab:>-,trail:<,eol:[,space:~

You may refer to the vim help documents (section listchars) for more details.

:help listchars

Published Jan 20, 2012

Flying code monkey