Vi Vim Less

show hidden characters

:set list
:set nolist

show line number

:set number

Basic search and replaceEdit
The :substitute command searches for a text pattern, and replaces it with a text string.

:%s/foo/bar/g

Find each occurrence of ’foo’, and replace it with ’bar’.

:%s/foo/bar/gc

Change each ’foo’ to ’bar’, but ask for confirmation first.

:%s/\<foo\>/bar/gc

Change only whole words exactly matching ’foo’ to ’bar’; ask for confirmation.

:%s/foo/bar/gci

Remove all empty lines

:v/./d