Text editor

From Wikipedia, the free encyclopedia
Jump to: navigation, search
For the use of text editors with Wikipedia, see Wikipedia:Text editor support.
An example of a text editor, Vim

A text editor is a type of program used for editing plain text files.

Text editors are often provided with operating systems and software development packages, and can be used to change configuration files and programming language source code.

Plain text files vs. word processor files[edit]

There are important differences between plain text files created by a text editor and document files created by word processors such as Pages,[importance?] Microsoft Word, and WordPerfect.

  • A plain text file uses a simple character set such as ASCII to represent numbers, letters, and a small number of symbols. The only non-printing characters in the file that can be used to format the text are newline, tab, and formfeed.
  • Word processor documents generally contain formatted text, such as enabling text to appear in boldface and italics, to use multiple fonts, and to be structured into columns and tables. These capabilities were once associated only with desktop publishing, but are now available in the simplest word processor.
  • Web pages are created as plain text, with HTML tags to achieve formatting.

Word processors were developed to allow formatting of text for presentation on a printed page, while text produced by text editors is generally used for other purposes, such as input data for a computer program.

When both formats are available, the user must select with care. Saving a plain text file in a word-processor format adds formatting information that can make the text unreadable by a program that expects plain text. Conversely, saving a word-processor document as plain text removes any formatting information.

History[edit]

A box of punched cards with several program decks.

Before text editors existed, computer text was punched into cards with keypunch machines. Physical boxes of these thin cardboard cards were then inserted into a card-reader. Magnetic tape and disk "card-image" files created from such card decks often had no line-separation characters at all, and assumed fixed-length 80-character records. An alternative to cards was punched paper tape. It could be created by some teleprinters (such as the Teletype), which used special characters to indicate ends of records.

The first text editors were "line editors" oriented to teleprinter- or typewriter-style terminals without displays. Commands (often a single keystroke) effected edits to a file at an imaginary insertion point called the "cursor". Edits were verified by typing a command to print a small section of the file, and periodically by printing the entire file. In some line editors, the cursor could be moved by commands that specified the line number in the file, text strings (context) for which to search, and eventually regular expressions. Line editors were major improvements over keypunching. Some line editors could be used by keypunch; editing commands could be taken from a deck of cards and applied to a specified file.

When computer terminals with video screens became available, screen-based text editors (sometimes called just "screen editors") became common. One of the earliest full-screen editors was O26, which was written for the operator console of the CDC 6000 series computers in 1967. Another early full-screen editor was vi. Written in the 1970s, it is still a standard editor[1] on Unix and Linux operating systems. Emacs, one of the first open source and free software projects, is another early full-screen or real-time editor, one that was ported to many systems.[2] A full-screen editor's ease-of-use and speed (compared to the line-based editors) motivated many early purchases of video terminals.[3]

Types of text editors[edit]

Some text editors are small and simple, while others offer broad and complex functions. For example, Unix and Unix-like operating systems have the vi editor (or a variant), but many also include the Emacs editor. Microsoft Windows systems come with the simple Notepad, though many people—especially programmers—prefer other editors with more features. Under Apple Macintosh's classic Mac OS there was the native SimpleText, which was replaced in Mac OS X by TextEdit, which combines features of a text editor with those of a word processor such as rulers, margins and multiple font selection. Some word processors, such as WordStar, can save files in plain text format, allowing them to be used as either a text editor or a word processor.

Text editors for professional users can edit files of arbitrary sizes, such as log files or unusually large texts, such as an entire dictionary placed in a single file. Simpler text editors may just read files into the computer's main memory. With larger files, this may be a slow process, and the entire file may not fit. Some text editors do not let the user start editing until this read-in is complete.

"Programmable editors" can be customized for specific uses. For example, Emacs can be customized by programming in Lisp. One motive for customizing is to make a text editor use the commands of another text editor with which the user is more familiar. The programming environments of many text editors are limited to enhancing the core functionality of the program, but editors such as Emacs can be extended almost without limit—for web browsing, reading email, online chat, managing files or playing games.

An important group of programmable editors uses REXX as the scripting language. These "orthodox editors" let the user open a "command line" into which commands and REXX statements can be typed. Most such editors are derivatives of XEDIT, IBM's editor for VM/CMS. Among them are THE, KEDIT, SlickEdit, X2, Uni-edit, UltraEdit, and SEDIT. Some vi derivatives such as Vim also support folding as well as macro languages, and also have a command line.

A text editor written or customized for a specific use can sense what the user is editing and assist the user, often by providing simple ways to retrieve related information. Many text editors for software developers include source code syntax highlighting and automatic completion to make programs easier to read and write. Programming editors often let the user select the name of a subprogram or variable, then jump to its definition and back. Often an auxiliary utility like ctags is used to locate the definitions.

Typical features[edit]

  • Find and replace – Text editors provide extensive facilities for searching and replacing text, either on groups of files or interactively. Advanced editors can use regular expressions to search and edit text or code.
  • Cut, copy, and paste – most text editors provide methods to duplicate and move text within the file, or between files.
  • Text formatting – Text editors often provide basic formatting features like line wrap, auto-indentation, bullet list formatting, comment formatting, syntax highlighting and so on.
  • Undo and redo – As with word processors, text editors will provide a way to undo and redo the last edit. Often—especially with older text editors—there is only one level of edit history remembered and successively issuing the undo command will only "toggle" the last change. Modern or more complex editors usually provide a multiple level history such that issuing the undo command repeatedly will revert the document to successively older edits. A separate redo command will cycle the edits "forward" toward the most recent changes. The number of changes remembered depends upon the editor and is often configurable by the user.
  • Data transformation – Reading or merging the contents of another text file into the file currently being edited. Some text editors provide a way to insert the output of a command issued to the operating system's shell.
  • Ability to handle UTF-8 encoded text.
  • Filtering – Some advanced text editors allow the editor to send all or sections of the file being edited to another utility and read the result back into the file in place of the lines being "filtered". This, for example, is useful for sorting a series of lines alphabetically or numerically, doing mathematical computations, and so on.
  • Syntax highlighting – contextually highlights software code and other text that appears in an organized or predictable format.
  • Extensibility - a text editor intended for use by programmers must provide some plugin mechanism, or be scriptable, so a programmer can customize the editor with features needed to manage individual software projects.

Specialised editors[edit]

Some editors include special features and extra functions, for instance,

  • Source code editors are text editors with additional functionality to facilitate the production of source code. These often feature user-programmable syntax highlighting, and coding tools or keyboard macros similar to an HTML editor (see below).
  • Folding editors. This subclass includes so-called "orthodox editors" that are derivatives of Xedit. The specialized version of folding is usually called outlining (see below).
  • IDEs (integrated development environments) are designed to manage and streamline larger programming projects. They are usually only used for programming as they contain many features unnecessary for simple text editing.
  • World Wide Web authors are offered a variety of text editors dedicated to the task of web development. These create the plain text files that deliver web pages. HTML editors include: Dreamweaver, E Text Editor, Microsoft FrontPage, HotDog, Homesite, Nvu, Tidy, and GoLive. Many offer the option of viewing a work in progress on a built-in web browser. XML editors share many traits.
  • Mathematicians, physicists, and computer scientists often produce articles and books using TeX or LaTeX in plain text files. Such documents are often produced by a standard text editor, but some people use specialized TeX editors.
  • Outliners. Also called tree-based editors, because they combine a hierarchical outline tree with a text editor. Folding (see above) can generally be considered a generalized form of outlining.
  • Simultaneous editing is a technique in End-user development research to edit all items in a multiple selection. It allows the user to manipulate all the selected items at once through direct manipulation. The Lapis text editor[4][5] and the multi edit[6] plugin for gedit are examples of this technique. The Lapis editor can also create an automatic multiple selection based on an example item.
  • Distraction-free editors provide a minimalistic interface with the purpose of isolating the writer from the rest of the applications and operating system, thus being able to focus on the writing alone.

See also[edit]

Notes[edit]

  1. ^ "The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition". The IEEE and The Open Group. 2004. Retrieved January 18, 2010. 
  2. ^ "Introducing the Emacs editing environment". 
  3. ^ "Multics Emacs: The History, Design and Implementation". "Some Multics users purchased these terminals ..., using them either as "glass teletypes" or via "local editing."" 
  4. ^ LAPIS: Smart Editing with Text Structure
  5. ^ Lightweight Structured Text Processing
  6. ^ New gedit plugin: multi edit, and a demo video.

External links[edit]