Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions

  




 

 

NOTE: CentOS Enterprise Linux is built from the Red Hat Enterprise Linux source code. Other than logo and name changes CentOS Enterprise Linux is compatible with the equivalent Red Hat version. This document applies equally to both Red Hat and CentOS Enterprise Linux.

Chapter 9. Working with Other Text Applications

Text editors fall somewhere between word processors like OpenOffice.org Writer and pager applications like less. These programs are useful for tasks like writing HTML, C, or SGML; they are best suited for any task that is text-oriented, and is not necessarily intended for print.

Programs that allow you to view PDF and PS files are referred to as text viewers. They do not allow a user to edit the text directly, but do allow the user to view the pre-formatted text.

9.1. Working with Text Editors

Red Hat Enterprise Linux comes with several applications that can be used to write and edit program code. These programs are text editors, programs that provide the user with helpful highlighting and formatting options without making changes or additions to the text. The most common of these text editors are vi and Emacs. Two additional useful editors are gedit and kate.

9.1.1. vi

vi is a shell prompt text editor. This means that like less, opening an instance of vi does not open a GUI window. Instead, the contents of the file being edited appear in the current terminal window. Because vi works without a GUI, it can be used to edit text files even when X is not working.

vi operates via keystrokes — listed below is a small set of the keystrokes necessary to work with text in vi.

Key Action
[i] With a file open, press [i] to enter Insert mode. This mode allows you to move the cursor and to delete and add text anywhere in the file.
[Esc] Pressing the [Esc] key at any time takes you out of Insert mode and into Normal mode.
[w] [w] writes your changes to the file. Enter Normal mode, press [Shift] -[:] , [w] , and finally press [Enter] .
[q] [q] quits vi. Enter Normal mode, press [Shift] -[:] , [q] , and finally press [Enter] . To save your changes before exiting, enter :wq. To quit without saving your changes, enter :q!.
[!] [!] forces vi to execute the commands that precede it.

Table 9-1. Useful keys in vi

vi uses many more keystrokes. To learn more about vi, view the manual page by entering man vi at a shell prompt. You can also access the vim tutorial but entering vimtutor command at a shell prompt.

9.1.2. Emacs

Emacs is a text editor that includes a GUI component. Like vi, Emacs also makes use of keyboard shortcuts to manipulate text. Users can choose between working with the mouse or the keyboard; all commands are available via either method.

Emacs can be customized extensively. Programs that customize syntax highlighting or add other functionality can be written and installed. Emacs even contains several games available from the Tools => Games menu, and a "psychiatrist" availabel from the Help menu.

An Emacs tutorial is available by selecting Help => Emacs Tutorial from the main toolbar.

9.1.3. gedit

gedit is the GNOME text editor. It has highlight modes for HTML, Perl, C, PHP, and many other languages. gedit features print preview, the ability to undo your changes, and tabbed editing. gedit is fully integrated with Nautilus.

9.1.4. kate

kate is the KDE text editor. It also has highlight modes for multiple programming languages. kate uses split screens to display multiple files. kate also has the ability to open a terminal window within the application. kate is fully integrated wtih Konqueror.

 
 
  Published under the terms of the GNU General Public License Design by Interspire