A

Using vi or Vim Editors

IN THIS APPENDIX

Using the vi editor

Starting/quitting the vi editor

Moving around in vi

Changing and deleting text

Using Ex commands

Using visual mode

Although easy-to-use graphical text editors (such as gedit and kedit) are readily available with Linux, most power users still use vi, nano, or Emacs to edit text files. In addition to the fact that those text-based editors will work from any shell (no GUI required), they offer other advantages. For example, your hands never have to leave the keyboard and they offer integration with useful utilities. And unlike GUI editors, text-based editors will work if no graphical interface is installed (as is true with many Linux servers and specialty devices).

This appendix focuses on features of the vi editor that can not only help you with basic editing, but also help you do some advanced text manipulation. I chose to cover vi rather than Emacs because vi is more universal and leaner, and also because vi keyboard shortcuts require fewer contortions.

Because many Linux systems use the Vim (Vi IMproved) editor by default, in place of the older vi editor, the descriptions in this appendix are extended to cover Vim as well. Some features in Vim that are not in vi include multiple undo levels, syntax highlighting, and online help.

NOTE If you have never used vi or Vim before, try out the tutor that comes with the vim-enhanced package. Run the vimtutor command and follow the instructions to step through many of the ...

Get Ubuntu Linux Toolbox: 1000+ Commands for Power Users, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.