Text Editors

 < Day Day Up > 



The first question we should address is, what is a text editor? A text editor is a program that enables you to enter text, alter it, and save it. In short, it is a program that enables you to edit text. To quote from a popular online Unix help page, www.gw.com/UNIXhelp/editors/, “you will often want to create a text file and then change its content in some way. A text editor is a program that has been designed especially for this purpose.” Text editors enable you to enter text and change the content. They generally don’t have advanced formatting or processing capabilities that you find in word processors. A simplified definition might be that a text editor is a very simple word processor. Linux is not limited to text editors. In fact, there are several complete word processors and office suites available for Linux. You can choose from Star Office, Open Office, Corel Word Perfect, and others. All of these are comparable with Microsoft Word. We will look at Open Office extensively later in this book. In fact, several chapters are devoted to Open Office. However, you may be used to having access to simpler text editors that you use for smaller, less demanding tasks. In Windows, you can go to Start, choose Programs (in Windows 2000 or 98 it was Programs, in Windows XP , it is All Programs), then select Accessories, and you immediately have access to both Microsoft Notepad and WordPad. Notepad is a very limited text editor. With Notepad you can essentially type in plain text with no formatting options. You can then either save the file or print it. WordPad, while not as feature rich as most commercially available word processors, does include basic word processing features. It is more than adequate for most simple word processing tasks. Simplified word processing applications such as Notepad and WordPad often are called text editors. The difference between a text editor and a word processor is the additional tools available in a word processor. However, there is no accepted demarcation line that indicates when some application is considered a word processor, versus when it is considered a text editor. Some purists would comment that a text editor is entirely separate from a word processor, and at one time that would have been accurate. However, more and more text editors are adding enhanced formatting to their capabilities, and more and more simplified word processors are being released. This has caused the line between text editor and word processor to be blurred considerably.

Now that we have discussed what a text editor is and mentioned some text editors found in Windows, you might be wondering if Linux also has some text editor applications for you to use. The answer is a resounding yes. In fact, when using the KDE graphical interface, you have a few different text editors to choose from.

We also have mentioned that Linux ships with full-fledged word processors. This might lead you to ask why would you use a text editor? There actually are several reasons. The first is that if you want a very simple tool to just type in text, a word processor might have more complexity than the situation warrants, especially if you are not overly familiar with that word processor. Text editors also are useful when you want to enter text that has no formatting at all. If you enter your own HTML code for Web pages, code for compilers, or just shell scripts (which we will do in Chapter 21, “Advanced Shell Functions”), then you need plain text with no formatting at all. Many word processors add formatting that may cause problems when you attempt to use the resulting text as a script or in a compiler. Finally, these text editors are so common in the Linux world that it would be a glaring omission not to introduce you to them.

Now you know what a text editor is, and you know some of the reasons why you might use one. We will now take a look at a few of the more common text editors you have access to in Linux.

Kate

The KDE interface comes with a text editor called Kate. Other graphical interfaces (such as GNOME) may have a very similar application called simply Text Editor. Whatever your distribution of Linux calls it, it is found in the same place and functions pretty much the same. Kate is a very simple text editor that enables you to enter text and to save that file to some location. It does not enable you to alter fonts or do any type of formatting. With Kate, you cannot align text, insert images, or draw tables and graphs. Kate is limited to entering plain text and saving or printing that text. It is quite a bit like Microsoft Notepad in that regard. To launch Kate, you would to go the K (recall that we mentioned earlier that depending on your distribution, you might have a capital K in the lower left-hand corner of your taskbar, or a red hat), find Accessories and select Kate (or select Text Editor). You should then see something very much like what is seen in Figure 5.1. Enter your text, then select File from the drop-down menu and Save As. You will then be able to save your file with any valid name you want, in any location you choose.

click to expand
Figure 5.1: Kate.

You probably noticed that the toolbar for Kate, as well as many other applications in KDE, looks very much like the toolbar for a Web browser. This is intentional. Many, if not most, KDE applications give you a standardized toolbar that works much like a browser. Once you get used to one interface, it will be the same for most applications. This is quite convenient, especially for the new Linux user who is trying to become comfortable with Linux. You also may have noticed another trend with KDE applications: many of the application names start with the letter K. You will quickly find that the Linux community is not without a sense of humor. Beginning KDE applications with the letter K is one example of this; the penguin symbol, named Tux, is another.

Using Kate is remarkably simple. You simply type the text you want on the screen, then select File and Save As. When you select Save As, you will be presented with a standard dialog box that looks very much the same as any other dialog box you may have used before, including the dialog box in Notepad or Word. This should look quite familiar to you, as Windows also uses a dialog box to open or save files. This dialog box enables you to choose a name for your file, as well as a location to save it.

Using Kate, or Notepad for that matter, you cannot do many of the basic word processing functions you may be familiar with. You cannot alter fonts, use bold or italic, insert tables or pictures, or many other standard word processing activities. This might make you wonder why anyone would want to use one of these simple text editors. The answer is that there are many tasks that do not need any of those word processing functions. In fact, for some tasks, those functions are a problem, rather than an asset. Such tasks include writing shell scripts, which we will cover in some depth later in this chapter, as well as writing Web pages in HTML. Either of these tasks requires simple text editing with no special formatting.

Simply because Kate and some other simple text editors lack complex formatting options does not mean that they do not provide you with useful tools. Microsoft’s Notepad application provides you with a search utility. If you have a lengthy document and you want to search for a word or phrase, you can simply select Edit and Find, and you will see a search screen, much like the one in Figure 5.2. You can then enter the text you want to search for and run your search.

click to expand
Figure 5.2: The Notepad search utility.

You have the same functionality in Kate. You even get to the search function in the same way. You select Edit, then Find, and you will be presented with the search screen shown in Figure 5.3. You also can use the shortcut keys Ctrl-F, just like in Notepad. Just as in Notepad, you can search forward or backward.


Figure 5.3: The Kate search utility.

Kate also has all the additional search options that Notepad offers. The Case Sensitive option is the most commonly used. If you select this option, the search will take you only to text that matches your search criteria in spelling and in case. In other words, with this option turned on, Bob is not the same as bob. Of course, you can leave the option turned off, and your search will ignore case.

Kate also offers some interesting options not found in Notepad. If you look under the View option on the drop-down menu, you should notice several options not found in Notepad. You can see the View menu in Figure 5.4.


Figure 5.4: The Kate view options.

The first two options enable you to select how Kate will be displayed. You have two panes, one listing the recently opened or used files and the currently open file, and the other displaying the file itself. The next two options determine whether or not you will see the icon border and the line numbers. Figure 5.5 shows both of these options turned on.

click to expand
Figure 5.5: Icon Border and Line Numbers options turned on.

As you can see, Kate is a fully functional text editor that gives you all the functionality you may have grown used to with Microsoft Notepad and some new functionality not found in Notepad. This is just one more example of what was stated earlier in this book. You may need to use some new applications to accomplish certain tasks, but you will find that you can do everything in Linux that you are used to doing in Windows. You may even find that you can do some tasks in Linux that you were not able to do with Windows.

KWrite

For some Windows users, Notepad simply does not provide the functionality they need. If they don’t want to purchase Microsoft Office, they might choose to use WordPad. WordPad is a fully functional word processor that is essentially a scaled-down model of Microsoft Word. It will handle most basic word processing tasks. If you are unfamiliar with WordPad, you can find it on any Windows PC by going to Start, select Programs, choose Accessories. There you will see it, listed with several other useful programs. You can see how WordPad looks in Figure 5.6.

click to expand
Figure 5.6: Microsoft WordPad.

WordPad has a number of formatting options, including the capability to select various fonts, bold, italic, align text, and more. For many basic word processing needs it is more than adequate. Unfortunately, none of the basic text editors that are part of KDE offer this functionality. However, Open Office, which installs with Red Hat Linux 8.0 and 9.0, supports all that functionality and more. We will examine Open Office later in this book. Also, there is a full word processor that is part of the latest version of the KDE interface, called KWord, and we will examine it later in this chapter. In the meantime, there are text editors besides Kate that come with the KDE interface and offer more functionality than Kate. KWrite is probably one of the most commonly used. If your installation does not include KWrite, you can get it from http://docs.kde.org/en/3.1/kdebase/kwrite/installation.html. That site also has complete installation instructions. Readers who are using the latest version of the KDE interface can go to Accessories, choose More Accessories, and click on KWrite. If you have an older version of the KDE interface, you get to KWrite by selecting Extras, Accessories, and KWrite. You can see the KWrite screen in Figure 5.7.

click to expand
Figure 5.7: KWrite.

You probably noticed that the KWrite screen looks very much like the Kate screen. Under the Settings drop-down menu you will see Show Icon Border and Show Line Numbers, just as you did with Kate. The difference between the two is that KWrite offers a few more tools than Kate. To begin with, under the Tools drop-down menu option you will find a spell checker, shown in Figure 5.8. A spell checker, for many people, is an indispensable tool. In fact, without a spell checker, the book you are holding in your hands would not have been possible!

click to expand
Figure 5.8: The KWrite spell checker.

There is another tool available in KWrite that is not available in Kate, Notepad, or WordPad. This tool probably will be of use only to the more technically savvy readers, but it is worth mentioning in any case. If you look under Settings, you will find an option to set Highlight Mode. This mode enables you to direct KWrite to highlight text in accordance with the structure of certain scripting languages, markup languages, and programming languages. This option is shown in Figure 5.9a.

click to expand
Figure 5.9A: The Highlight mode setting.

For example, if you want to use a text editor to write your own HTML documents, you can use this feature to detect errors in the document you write.

Note 

HTML, or Hypertext Markup Language, is the language that Web pages are written in. If you use one of the popular Web page development tools such as Microsoft FrontPage, Macromedia Dreamweaver, or Adobe PageMill, they are actually generating HTML code for you. If you know HTML or learn it, you can develop your own Web sites using a basic text editor, with no need to invest in an expensive Web development tool.

We have now examined two of KDE’s built-in text editors and compared them to Microsoft’s WordPad and Notepad. You should now be able to do simple text editing in Linux as easily as you did it in Windows. More technically inclined readers can now use KWrite for editing source code for HTML documents and many programming languages. Please keep in mind that Linux has several fully functioning word processors that are on a par with Microsoft Word. We will be exploring one of these later in this book.

KWord

As mentioned earlier, the latest version of the KDE interface comes with its own word processor, called KWord. You can get to KWord by going to Office, selecting More Office Applications, and clicking on KWord. Remember that, if you are using an earlier version of Linux, you might find this under the older Extras category. When you launch KWord, you will be prompted to choose what type of document to start with. This is shown in Figure 5.9b.

click to expand
Figure 5.9B: The opening screen for KWord.

As you can see, you have several options for how to start. For our purposes we will start with an empty plain text document. This takes you to the main working screen of KWord, shown in Figure 5.9c. We will examine some of the options you have available to you to manipulate and format text. First, you will need to enter a few sentences so that we have some text to work with.

click to expand
Figure 5.9C: The working screen for KWord.

Much of the toolbar should look familiar to you. Most word processors have similar functionality, so all word processors’ toolbars also have some commonality. You can see the buttons that enable you to select the font, font size, bold, italic, and underline. These are very basic word processing functions found in almost all word processors, including Microsoft’s Word and WordPad, as well as Corel WordPerfect . The drop-down menu at the top of KWord offers some standard options as well. The most interesting part to examine in most word processors is the objects you can insert into your document. If you click on Insert in the drop-down menu, you will see something like what is shown in Figure 5.9d.

click to expand
Figure 5.9D: The Insert options for KWord.

Just like in Microsoft Word, you can insert footnotes, pictures, formulas, and tables. If you have a scanner attached to your PC, you can use the Scan Image option to go directly to the scanner, acquire an image, and insert that image into your document. Pictures are frequently added to documents to improve their appearance. If you choose Insert and select Picture, you will be presented with a dialog box that will enable you to select any image from your hard drive and insert it into your document. However, this is one area where Microsoft Word is superior to KWord. Microsoft Word comes with a host of images you can select for various purposes. KWord does not.

Aside from basic formatting and inserting images or formulas, the Tools section is the most important. If you select Tools from the drop-down image, you should see something very much like the image in Figure 5.9e.


Figure 5.9E: Tools.

There are two options here that are indispensable to most people using a word processor. The first is Spellcheck. Most people, including the author, are very dependent upon their spell checker. The second item that should attract your attention is Autocorrection. This option enables you to turn Autocorrection on or off. With Autocorrection on, your spelling will be corrected as you type.



 < Day Day Up > 



Moving From Windows to Linux
Moving From Windows To Linux (Charles River Media Networking/Security)
ISBN: 1584502800
EAN: 2147483647
Year: 2004
Pages: 247
Authors: Chuck Easttom

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net