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
kedit) are readily available with Linux, most power users still use vi or Emacs to edit text files. Besides the fact that vi and Emacs will work from any shell (no GUI required), they offer other advantages such as your hands never having to leave the keyboard and integration with useful utilities. And unlike GUI editors, text-based editors are usable over slow Internet connections such as dial-up or satellite.
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. We chose to cover vi rather than Emacs because vi is more universal and leaner, and also because vi keyboard shortcuts only require two arms. Because many Linux systems use the Vim (Vi IMproved) editor 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.
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 key features of vi and Vim.
If you want to experiment with using ...