vi

Visual editor

SEE ALSO

For more information, see Chapters 20 and 21.

Starting vi:

vi -r means display files that can be restored.

view file means run vi in read-only mode.

Colon commands:

:abbrev word means new phrase.

:!cmd means run UNIX cmd in subshell, and then resume vi.

:f means show current line number and filename.

:map c string means map character c to string.

:q! means quit without saving.

:w means write changes to disk.

:w file means save in file.

:wq means write (save changes) and quit.

Format for the following:

:set mode:set abbreviation:set mode to off
:set autoindent:set ai:set noai
:set ignorecase:set ic:set noic
:set number:set nu:set ...

Get Practical UNIX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.