Appendix A. Using vi or Vim Editors

Although easy-to-use graphical text editors (such as gedit and kedit) are readily available with BSD systems, 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 some UNIX-like systems use the Vim (Vi IMproved) editor in the 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 vim6 package. Run the vimtutor command and follow the instructions to step through many of the key features of vi and Vim. To see the differences between vi and Vim, type : help vi_diff.txt ...

Get BSD Unix® Toolbox: 1000+ Commands for FreeBSD®, OpenBSD, and NetBSD® 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.