When working with files, it’s often useful to see special characters such as tabs or end of line (EOL) characters. Let’s see how we can do this in Vim.
First, once we’ve opened a file in Vim, type the following:
:set list
This allows us to enable list mode, which shows tabs as ^I
and end of lines as $
.
Next, we can choose how we render the special characters. For our example, let’s render tabs as >·
, trailing spaces as ·
and end of lines as ¶
:
:set listchars=tab:>·,trail:·,eol:¶
Finally, when finished, let’s hide the special characters:
:set nolist