Learn Essential Vim Skills
with Drew Neil, author of Practical Vim
Whitespace
category applies to 6 screencasts:
There are times when you can improve the readability of your code by lining up the elements on neighbouring lines. In this episode, I demonstrate how this can be achieved using the Tabular plugin.
Watch screencastThis episode covers the commands for shifting text left and right (<
and >
), and also goes over the auto indent command (=
).
This episode demonstrates a few techniques for tidying up whitespace. First, it looks at how to convert between tabs and spaces. Then it shows how to strip trailing whitespace, and finally, how to remove blank lines from a file.
Watch screencastDifferent file types may require particular whitespace settings. For example, YAML files must be indented using spaces, whereas makefiles require indentation with tabs. These preferences can be specified by hooking into the FileType
event with an autocommand.
Vim offers very granular control over whitespace. This episode explains the purpose of tabstop
, softtabstop
, shiftwidth
and expandtab
settings, and illustrates how Vim behaves using various combinations of these.
Vim’s list
feature can be used to reveal hidden characters, such as tabstops and newlines. In this episode, I demonstrate how to customise the appearance of these characters by tweaking the listchars
setting. I go on to show how to make these invisible characters blend in with your colortheme.