Java open text editor in Linux. Best Text Editors for Linux Command Line

A text editor may be needed at any moment, for example, to write code or simply change a configuration file. There are a great many of them in the Linux operating system, and they behave differently and have their own strengths and weaknesses. Many text editors provide functions that will be useful to programmers, such as syntax highlighting, automatic indentation, etc. Such tools allow you to understand at first glance that the entered code is generally correct and the blocks are nested correctly. Syntax highlighting clearly highlights keywords and also displays variable names and data in different colors. Automatic indentation helps you see each block of code individually, and nested blocks are indented further, making it easier to read. Another important factor is the editor's ability to work in a text console. This is useful when the graphical shell refuses to work, and it is necessary to make some adjustments to the system configuration files.

The editor is built into the Linux Mint 18.3 distribution and not only into it. Launched by the command nano in the terminal.

Nano is one of the simplest editors. It does not have support for useful functions for the programmer. As a plain text editor, it does its job well. The basic commands that perform the actions are listed at the bottom of the screen and are sufficient for simple editing of the configuration file. The editor supports spell checking without adding new words to the dictionary. The main functions of the program are accessible by pressing the command key while holding down the Crtl key.

sudo apt install kate.

kate, and in the “Menu” in the standard section.

The editor has a rich set of tools for the programmer, and support for plug-ins allows you to expand its functionality indefinitely. Kate works only in graphical mode, which in turn allows developers to focus on its advantages and get a cohesive editor with a set of functions. It is quite accessible for beginners. Kate is an editor for programmers, which allows you to use regular expressions when searching, syntax highlighting, automatic indentation, and code folding. In addition to tools for developers, the editor contains project management functions; you can create a project as a set of files and opening it will open each of its files in a separate tab. Kate allows you to manage your project and collapse blocks when. You can create a bookmark anywhere in the file, which will later allow you to instantly return to it through the main menu. Another feature of the editor is to highlight any text and make a typo using Google.

To install the editor, enter the command in the terminal: sudo apt installvim.

The launch is carried out by the command vim.

This text editor will not leave anyone indifferent, it is the most powerful application. Additional Emacs functions are called by various keyboard shortcuts. The disadvantage of the editor is, due to its extensibility, its greed for RAM. Although for a modern computer this is not a particular problem. In fact, Emacs is an Editor Macros editor with macro commands, which is why it gained popularity. It can be used as a Web browser, as an email client, even simple games have been written for it, and much more. In addition, Emacs can be used for scheduling and task management. It is used mainly by programmers. It has everything including menu items for compiling the typed code and calling the debugger of the running program. The editor can work in both graphical and text mode. Which in turn allows you to use the editor even if the graphical environment does not start. The keyboard combination for the set of functions is very well constructed.

To install the editor, enter the command in the terminal: sudo apt installgedit.

The launch is carried out by the command gedit, or through the “Menu” in the “Standard” section.

Gedit is the official Gnome editor. It occupies a niche between a regular notepad and an editor for programmers, and does not really cope with either task. It has features for programmers, such as syntax highlighting, indentation, etc. However, its functions are so primitive that they are unlikely to please programmers. Extensibility via plugins or running shell scripts on an open file is out of the question. The spell check turned out to be defective. The editor is quite suitable as a regular notepad for recording ordinary notes.

The list editor in the Linux operating system is not limited to this list; it is only a small fraction of what is available. Which editor to choose is a purely personal matter for everyone.

Not popular. There are few reasons for this, but the main one is that there are very few games on this OS, and this is now a powerful argument for young people. However, most Linux fans switch to it for work, since that is what it is best suited for. True, most people first encounter the presented OS after using Windows, and this fact slightly reduces the barrier to entry. Of course, you can find distributions very similar to Windows, but there will still be many questions left.

This article is intended to tell you what text editors there are in the Linux operating system.

What is a text editor?

To explain, it is not necessary to go into terminology and load the listener with various abstruse words. That's what we'll do.

They allow you to work with written material in a convenient and understandable graphical environment, that is, an interface. Moreover, it is not necessary that the program be able to format text or print it. Even an ordinary notepad, which is available on Windows, is suitable for this concept. But of course, nowadays there are programs that allow you to edit text as you please.

We are now talking about programs that are used in Linux, and therefore it is necessary to start from them and forget about notepad. There are various text editors on Linux, the list of them is unusually large, so not all will be listed. Let's talk about just the three most common ones:

  • Writer;
  • AbiWord;
  • Gedit.

They are very similar and radically different from each other at the same time, so now let’s take a closer look.

Writer - the second Word?

Many people are afraid to switch to Linux because they may not find convenient and favorite programs there, as on Windows. And this is true, since they are not there. But few people know that there are a huge number of analogues on Linux.

Thus, the Writer program from the LibreOffice office suite is called the second Word. And when asked, Linux editors all point to this first.

Writer is best suited for working with text. With this program you can edit and format what you have written to your heart's content. In addition, it has excellent compatibility with other similar programs, such as Word. This means that documents created in Writer will also open in Word.

If you need a heavyweight editor with a ton of features, then Writer is perfect for you. However, if you are not an editor, and you do not have a professional need to significantly edit the text, then you simply do not need all the functions of this program. And an unnecessary interface will only distract. Therefore, let's move on to the next “exhibit”.

AbiWord: no frills

If you need a text editor that can easily open any files of this format and at the same time does not burden you with complex options and functions, then AbiWord is for you. If you look for an analogy with Windows, then the closest copy would be NotePad.

AbiWord is designed for reading documents rather than editing them. Of course, this is said loudly, because the program’s functionality has a huge number of editing methods, but still, if you write dissertations and coursework, it is better to use Writer.

AbiWord is necessary in cases where you need to open a document with all formatting settings saved in it. The program has perfect compatibility with the .doc format, which allows you to easily open Word documents. This program is an excellent spell checker, so if you are an editor, then this software is for you.

AbiWord works great with the following file formats:

  • TEXT;
  • HTML;
  • GABW;

In addition, you can open ODT, SDW and WPD using plugins.

Gedit: a lightweight editor

Since the tendency to find analogues of presented programs has become fashionable, Gedit is an analogue of a regular Windows notepad. Gedit is designed for opening text documents, and it does this task well. Of course, it will not provide you with a wide range of possibilities and it will not be able to offer you high-level work with it, but it guarantees you the performance of one non-trivial task - reading.

This program is suitable if you do not need to work in depth with the text. If all you need is the transfer of information without various visual techniques, then Gedit will definitely not be able to overwhelm you with the complexity of its interface, which means it will not distract you with unnecessary information, which is good.

This software has practically no disadvantages, because it does not initially claim to be the best text editor. But it still provides the opportunity to work with text.

Conclusion

So we figured out what text editors there are in Linux. Of course, this is not the entire list, because if we listed everything, the article would be too lengthy. The main and most popular programs were touched upon. But this is exactly what is required? And everything listed above perfectly fits the definition of a text editor.

Now you can easily explain, if necessary, what text editors there are on the Linux operating system, and, moreover, you can describe each of them.

There are many text editors designed specifically for the Linux platform, but the most useful among the existing ones are the so-called integrated development environments. They are used not only for creating text documents, but also for developing applications. The most effective are the 10 programs that will be presented in this article.

First of all, it is worth saying that this list does not represent the TOP; on the contrary, all the software that will be presented later in the text is “the best of the best”, and which program to choose is up to you.

VIM

This application is an improved version of the VI editor, which is used as a standard program in the Linux operating system. The VIM editor has expanded functionality, increased power and a number of other parameters.

The name stands for VI improved, which means “improved VI”. The application was developed taking into account all the needs of developers. It has a huge number of settings, so among Linux users it is often called the “Editor for Programmers”.

You can install this application on your computer by one by one entering the following commands into "Terminal":

sudo apt update
sudo apt-get install vim

Note: after pressing Enter you will be asked for the password that you specified when registering in the system. Please note that when you enter it, it does not appear in any way.

As with VI, it can be used both on the command line and as a separate open application - it all depends on how the user is used to doing it. In addition, the VIM editor has a number of distinctive characteristics:

  • syntax is highlighted;
  • a tag system is provided;
  • it is possible to expand the tab;
  • session screen available;
  • you can split the screen;
  • various types of compound characters are entered

Geany

The Geany editor is a fairly popular software that has a built-in set of GTK+ utilities. It is also intended for program development.

If there is a need to install a program equipped with the functionality IDE, then this editor will be an excellent option. The program allows you to work with almost all existing programming languages, and it functions regardless of other packages.

To install the program, you should enter two commands in turn:

sudo apt update
sudo apt install geany –y

and press after each key Enter.

The editor also has a number of features:

  • Thanks to flexible settings, you can customize the program for yourself;
  • all lines are numbered so that the code can be easily traced if necessary;
  • It is possible to install additional plugins.

Sublime Text Editor

The presented text editor provides a huge number of functions, which allows it to be used for editing or creating text, as well as as an IDE.

To download and install the presented text editor, you need to run one by one: "Terminal" the following commands:

sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer

A distinctive feature of this software is its support for all major programming languages, as well as markup languages. A large number of plugins are provided, due to which the functionality can become much wider. The application has a very important feature: with its help you can open any part of the code of any file located on your computer.

In addition, Sublime Text Editor is distinguished by a number of other features that distinguish this editor from similar programs:

  • API plugins are developed based on the Python programming language;
  • the code can be edited in parallel;
  • Each created project can be configured separately if desired.

Brackets

This program was developed by Adobe back in 2014. The application is open source, and it has a large number of different features that can greatly facilitate your work.

Like most of the programs presented in this article, Brackets has a clear interface that the user can easily understand. And thanks to the interaction of the editor with the source code, it is quite convenient to do programming or web design. By the way, it is precisely this characteristic that distinguishes it favorably from the same Gedit.

The application is based on platforms HTML, CSS, JavaScript. It takes up a small amount of space on your hard drive, but in terms of functionality the program can give a head start to a number of other editors.

This editor is installed by one by one entering "Terminal" three teams:

sudo add-app-repository ppa:webupd8team/brakets
sudo apt-get update
sudo apt-get install brackets

A number of distinctive characteristics include the following:

  • it is possible to view the program code in real time;
  • inline editing is provided;
  • you can use so-called visual tools;
  • the editor supports a preprocessor.

Gedit

If you have to work with the GNOME desktop, then this text editor will be used by default. This is a fairly simple program that is small in size and has a basic interface. It definitely won’t take long to get used to it.

To install the presented text editor on the system, you must "Terminal" run the following commands:

sudo apt-get update
sudo apt-get install gedit

This application first appeared back in 2000; it is based on the C programming language, but is capable of supporting a wide variety of input languages.

The application has a number of features:

  • support for almost all existing programming languages;
  • syntax highlighting for all languages;
  • the ability to use different kinds of alphabets.

Kate

The Kate editor is installed by default in Kubuntu, and is a very simple and lightweight program that allows you to simultaneously work with several files in one window. The presented application can be used as a very powerful development environment.

In order to install Kate on Ubuntu or Linux Mint, in "Terminal" enter the following commands:

sudo apt-get update
sudo apt-get install kate

The program does not have many features when compared with other text editors:

  • the application will detect the language automatically;
  • When working with ordinary text, the program itself will place all the necessary indents.

Eclipse

A fairly widespread program among Java developers, since it itself was created in this language. It provides a huge variety of functions that allow you to create applications on the Java platform.

If the user needs to use other languages, then he will only need to install the appropriate plugins.

The program can be used for development and web design in Python, C, C++, PHP, COBOL and other languages. To install an application on Ubuntu or Linux Mint, enter two commands alternately in the program line:

sudo apt update
sudo apt install eclipse

There are several unique characteristics in this software:

  • one of the most reliable tools designed for developers using the Java platform;
  • supports a large number of plugins.

Kwrite

The Kwrite program first appeared in 2000. It was created by the KDE team, and in this case the text editor Kate was used as the basis, which was expanded using the latest KParts technology from KDE. In addition, with the release a large number of exclusive plugins were introduced, through which the functionality of the software can be significantly expanded.

Another quality of the presented software is the ability to use it to edit deleted and even encrypted files.

The program is installed after executing the following commands:

sudo apt-get update
sudo apt-get install kwrite

It has some distinctive characteristics:

  • she is able to complete words automatically;
  • indentations are set automatically;
  • syntax is highlighted;
  • there is a possibility of integration VI.

Nano

Nano is one of the most popular text editors designed specifically for UNIX platforms. In terms of functionality, it is very similar to the Pico application, and the first version of the program was developed back in 2000. It has a huge number of additional features, thanks to which developers consider it a very advanced editor for source code and text. However, it also has one very significant drawback: Nano is displayed only in the command line interface.

To install the Nano application on your computer, run the following commands in "Terminal":

sudo apt-get update
sudo apt-get install nano

The application has several unique characteristics:

  • has a preset search that is case sensitive;
  • capable of supporting Autoconf.

GNU Emacs

This editor is one of the most “ancient” ones; it was created by Richard Stallman, who at one time founded the GNU project. The application is quite widespread among Linux programmers; it is written in C and LISP.

To install the program on the Ubuntu and Linux Mint platforms, enter two commands in turn:

sudo apt-get update
sudo apt-get install emacs

The application has the following characteristics:

  • it allows you to work with mail and various types of newsletters;
  • has fairly wide support for alphabets and programming languages;
  • provides the ability to work with the debugger interface by installing an exclusive extension.

Conclusion

You should choose a text editor for systems based on the Linux platform depending on the tasks at hand, since each of the software products reviewed is more suitable for certain purposes.

In particular, if you plan to work with JavaScript, then it is best to install Eclipse; for a large number of different programming languages ​​and other alphabets, the Kate application will be the most suitable.

One of the most popular programs used, after the browser and file manager, is the Linux text editor. Among its many functions are writing codes, editing configuration files and creating user instructions or notes. The entire extensive list is not limited to this.

Text editors in Linux exist in 2 types - console and graphical editors. Graphics reactors are editors with a graphical interface for users. Console editors are more often used by servers, while graphical ones are more suitable for home use. If you need to find a powerful editor, you should check out the list of the best. The purpose of the article is to consider open source Linux text editors of two directions. This is not a limited list, as their number is constantly growing, as is the range of functions provided.

Among the old, proven and quite reliable ones, it is worth highlighting: Vim, Emacs and Nano. Relatively new text editors in Linux, but already proven ones, are Atom, Brackets and Sublime Text. There are a number of other, no less positively proven text editors for Linux.

Brief characteristics of Linux

When you buy a new computer, laptop or server and install Linux, you want to know what hardware is actually in the Linux box and, more importantly, what hardware is supported by the kernel out of the box and which needs special configuration with modules to provide his full work.

Linux is an operating system similar to the Unix family, which is based on the Linux kernel. Linux contains a set of utilities and programs included in GNU. It is possible that it may be included in other components. Systems built on top of the Linux kernel are typically distributed and created in a manner similar to free, open source software developments. They are difficult to find on sale, since they are distributed free of charge, under the guise of various distributions. They often do this in the form of programs that are ready to install and use completely free of charge. They are convenient and practical to use, which makes them quite popular. The programs are presented in the form of applied and system components, free and proprietary.

Many people are afraid to switch to Linux, not wanting to lose access to the Windows operating system programs that are familiar to us. However, not many people realize the variety of analog programs available on Linux.

Without further delay, let's begin our list of the most impressive, feature-rich source code editors.

Geany

Geany is an excellent text editor that integrates the GTK+ toolkit to provide a great development environment. If you're looking for a text editor that doubles as an IDE, Geany could be a great choice. This lightweight IDE understands basic programming languages, and also has several software packages that the editor depends on. Notable features of Geany are:

  • plug-in interface;
  • syntax highlighting;
  • line numbering, etc.

It comes with a clean interface and lots of customizable options. The writing language is C and C++.

AbiWord

AbiWord is more suitable for reading files, although its work panel is equipped with many functions for editing documents.

Among the functions it is worth highlighting:

  • Checking for errors in the finished document.
  • Full preservation of original formatting.
  • Supports the following ABW formats; TEXT; AWT; HTML; DOC; GABW; RTF.

The need for a simple text editor, without any frills, will be fully provided by AbiWord. It can handle opening any file. Ease of use is due to the lack of burden on the system due to the presence of complex options and functions. If we look for an analogy, in Windows these functions are performed by NotePad++.

Brackets

Brackets is a web development editor written for HTML, CSS and javascript languages, Brackets created in Adobe systems. This free software is licensed under the MIT license and is maintained on GitHub.

Brackets (translated as Brackets) is a popular text editor that was launched by Adobe back in 2014. The free text editor comes with Live Preview, Inline Editing, visual-oriented preprocessor support tools and other cool features:

  • hints while writing text;
  • syntax highlighting;
  • increased number of plugins and extensions.

Built from the ground up, it is designed for web designers and front-end developers.

Despite the ease of use, this text editor is source code, plus it is loaded immediately with all the basic qualities of a modern text editor. It is written for HTML, CSS and JavaScript.

KWrite

KWrite, whose first public release was in 2000, is a lightweight text editor developed by KDE. It is based on the KATE text editor and KDE KParts technology. Key features of KWrite:

  • automatic word completion;
  • automatic indentation;
  • syntax, allocation occurs based on the type of file created;
  • Vi input mode and plugin support.

Other cool KWrite functionality:

  • extensibility;
  • coding support;
  • remote file editing.

The KWrite editor is written in C++.

Nano

Nano is a convenient text editor that is widely used in Unix-like operating systems. Nano, first released in June 2000, emulates the Pico text editor and comes with additional features. It runs in a familiar command line interface. If you're used to spending days and nights fiddling with configuration files in the terminal, Nano will suit your needs. Its main features include autoconf support, case search function, auto indentation, interactive search and replace, tab completion, soft text wrapping, etc. The editor is written in C programming language.

GNU Emacs

There is an opinion that Emacs will become one of your favorite Linux text editors. It has been around for a long time. GNU Emacs, created by GNU Project founder Richard Stallman, is its most popular version, used by Linux developers and enthusiasts around the world. Written in the Lisp and C programming languages, this free software is extensible using the full Turing programming language. GNU Emacs users also have extensive documentation and tutorial support. Extensions such as the debugger interface, mail and news are also available there.

Gedit

Gedit loads by default as a text editor included with the GNOME desktop.

This general purpose text editor aims to be simple and easy to use. Following the philosophy of the GNOME Project, Gedit comes with a clean and intuitive GUI. Written in the C programming language, Gedit was first publicly released in 2000. This open source and free software fully supports internationalized text.

Gedit contains a feature to configure syntax highlighting for different programming languages ​​such as C++, C, HTML, Java, XML, Python, Perl and others.

The editor is perfect if there is no need to completely and fundamentally change the text of the source document. If the main task is simple information transfer, then Gedit will definitely not be able to overload its interface with the complexity. This will allow you to fully concentrate on the task at hand.

Vi/Vim Editor

Vim, or Vi IMproved, is a feature-rich text editor that is designed to provide better performance and extend the capabilities of the de-factor Unix editor "Vi". Vi/Vim is a customizable text editor that is built to meet the needs of the developer. This is why it is often called the "programmer's editor". Its purpose is to use it as a command to write on the command line, and as a stand-alone application in a graphical interface. Although beginners complain that the editor is difficult to use, after testing they understand that Vi/Vim is one of the most powerful text editors. Its main core models are automatic commands, digraph input, split screen, session screen, tab expansion, syntax coloring, and tagging system. Vim editor is written according to C and Vim script.

Atom

Atom is a text editor developed by GitHub, with source code, for free use by consumers. Based on Electron (CoffeeScript, JS, Less, HTML), Atom is a desktop application built using web technologies. Often referred to as the text editor of the 21st century, it is a modern text editor that is hacked to the kernel. Key features of Atom:

  • cross-platform editing;
  • built-in package manager;
  • file system browser;
  • support for multiple panels;
  • word search and replacement function;
  • Intelligent text auto-completion.

There are 1,000 open source packages to choose from to add new features to Atom. Atom can also be customized to suit a consumer's needs and style.

Sublime Text

In our own poll on the Fossbytes Facebook page, Sublime Text, followed by Atom and Vim, came out as the favorite. This full-featured text editor is built for "code, markup, and prose." It supports many programming languages ​​and markup languages. By using plugins that are supported by free software licenses, you can expand the functionality. "Goto Anything" is a popular Sublime Text feature that allows you to quickly move through files, lines, or characters. Other major features of Sublime Text are the command palette, Python-based plugin API, concurrent editing, project-specific settings, etc.

Interested users can find download links and more details about Sublime text on the official website.

When choosing a convenient text editor for yourself, you should not limit your choice to this list. Since it cannot be said that it is the most comprehensive list of the best text editors for Linux. After all, writing the entire list will require a lot of time and attention from the reader. Which will confuse and make it difficult to choose. Our task is to help choose the best editor for everyone, suitable for general requirements. The list includes the most popular editors for Linux users that have received the most positive reviews.

There are still a lot of text editors developed by software developers who have the right to qualify for inclusion in this list. Their functions are also varied and interesting to use. Somewhere more, somewhere less. The choice of a specific editor is the choice of each individual user, who has his own needs and requirements.

More details about the characteristics of editors for Linux Nano and Vim:



Chapter 12. Programs for working with text

12.1. A few words about text file formats

As you know, any file, including files in which text documents of one kind or another are stored, is simply a sequence of bytes. Text characters are encoded with different byte values ​​or sequences of bytes. Information about how exactly these characters should be positioned on the page is also encoded using non-displayable control characters, such as end-of-line or tab characters. In the simplest cases, the number of control codes is limited to the first 32 byte values ​​(or ASCII code), and all remaining byte values ​​are used to encode information characters. It is these files that we call ASCII files. Examples of such files include files created by editors such as the built-in editor in Midnight Commander, files created by notepad on Windows, and vi on UNIX.

Over time, there was a desire to expand the possibilities of text formatting, which meant that it was necessary to increase the number of codes used as control codes, and sequences of bytes (ASCII characters) even began to be used as such codes. But the important thing is that these formatting sequences (almost) do not prevent you from reading the text contained in the file using any simple viewer or simple text editor. Examples of such files are files created by editors such as Lexicon, files in html format.

The third type is files that use their own format to represent text (in which text characters are also represented by special sequences). The most significant difference between the third type of formats and the two previous ones is that it is almost impossible to view and create files in such formats without special programs. For example, HTML files can be edited using Notepad, but the same cannot be done with MS Word 97 format files.

Sometimes it is difficult at first glance to attribute a file to one type or another. For example, Post Script files are technically type 2 because all readable text is in ASCII code, but these files contain so many formatting inserts that the text can only be found with great difficulty, much like in type 3 files.

It follows from the above that even viewing some types of text files (not to mention editing them) requires special software. Often, to view files, the user uses his usual text editor. But there are situations when information is presented in a format unfamiliar to this editor. The biggest problem for Linux fans is the formats used in Microsoft products. While most PC users create texts in MS Word, they have to either find a text editor that understands Word formats, or find translators from the Word format to one of the open standard formats. However, even if the information is presented in “simple” ASCII code, when viewing a file, you may encounter “unreadable” text due to the difference in Russian language encodings used. So first let's look at how to read (or view) files in different formats or encodings.

12.2. Programs for viewing texts in different formats

I read somewhere that the UNIX tradition was to create a separate command for each elementary action. This observation is well illustrated by the presence in Linux of a whole host of separate programs for viewing files. Of course, if you're using a file manager like Midnight Commander or Konqueror, you'll be using their built-in file viewers. But in some cases, it may be useful to know how to view the contents of a particular file, simply working in the terminal.

12.2.1 Traditional UNIX tools for viewing text files

The easiest way to view a file is probably the cat command. After displaying the contents of the current directory using the ls command, you can also display the contents of any existing files with the cat command. However, one inconvenience arises: if the file is large, then as a result only its last lines remain on the screen, everything else “runs up.” You can, of course, scroll through several screens using the ‹Shift›+‹PgUp› keys, but this possibility is also limited (some value set in the environment, by default - a value of 1000 lines).

To organize page-by-page output, there is a filter command more. It can be used in two equivalent versions:

The less command is an improved and modified version of the more command, which is recommended to be used instead of more in all cases. Keep in mind that the less command is used to display interactive man pages.

To view only the last few lines of a text file, there is a special tail command, which can be used to specify the number of lines to be output as a parameter. It can be assumed that having such a command was very useful in those days when text files were created using the cat program, by direct input from the terminal, something like this:

In this case, after any break in work, it was simply necessary to review the last of the entered lines in order to remember where the work was stopped.

However, those days are long gone. To create texts, they began to use text editors, and for saving - not simple ASCII files, but special, quite sophisticated formats that allow you to save not only the text itself, but also information about paragraphs, pages, styles, fonts and much more. And to view such files, special programs began to be required (in computer geek slang - viewers), which do not display all special formatting characters on the screen, but convert them into the corresponding indents, protrusions, spaces, fonts, etc. Let's consider such viewers for two common file formats.

12.2.2 Acrobat Reader (version 4.05)

Acrobat Reader is designed to view files in the Portable Document Format (pdf), which is widely used in the computer world and is used in different operating systems and on different platforms. PostScript documents can be easily converted to this format. PDF files are very common on the Internet. It is not necessary to be able to create such files (programs for creating them are distributed commercially), but you need to be able to read them. The Acrobat Reader program from Adobe Systems Incorporated, distributed free of charge in both versions for Windows and versions for UNIX, and in particular for Linux, serves precisely this purpose. Currently, version 4.05 of this program for Linux can be obtained for free on the company's website http://www.adobe.com (version 5.0 has already been released for Windows).

To install Acrobat Reader 4.05 you will need 12 MB of disk space, and to work with the program - 32 MB of RAM. If you had version 3.0 of this program installed, you must first remove it.

Before you begin installation, choose one of two possible installation options: network or local (on a separate computer).

Local installation guarantees you access to the program on a given computer and can provide significantly better performance (especially compared to working over a busy network). For local installation, you, of course, must have write permission to the directory where the program will be installed.

Network installation makes it easier to solve the problems of administering and supporting the program, especially in cases where the program is used by many users. Obviously, it is easier to update one instance of a program on a server than to update multiple copies on separate computers. Network installation must be performed by the server administrator.

However, network installation also has some disadvantages. The server must be highly reliable and the installed files must be installed in a directory that must be mounted in the same way (to the same mount point) on all workstations on the network.

By default, Acrobat Reader is installed in the /usr/local/Acrobat4 directory (use the df command to verify that there is enough free space on the appropriate disk partition).

If you received the Acrobat Reader file from a Web site, you must first unzip the installation files using gunzip and tar. After this, you need to go to the directory containing the installation script and run it:

The installation script displays several questions on the screen, in particular about which directory to place the program files in. For each question, an answer option is offered, which can be accepted by simply pressing the ‹Enter› key. If the default answer does not suit you, enter your own answer. Otherwise, you just need to follow the instructions given by the installation program. If you make a mistake somewhere, you can interrupt the installation with the combination ‹Ctrl›+‹C› and start all over again.

In the end, a message appears stating that the installation was completed successfully (in English, of course, something like “installed successfully”).

After installation, several subdirectories are created in the directory where you installed the program (let me remind you that by default this is /usr/local/Acrobat4):

The bin directory contains a script to run the program,

The Reader directory contains help files and some platform-specific files (see note below),

The Fonts directory contains fonts,

The Browsers directory contains a script to launch Acrobat Reader from the Netscape browser.

Note

If you chose the network installation option, then several binary file options will be installed in the Reader directory, and the program launch script will select the binary file option that is needed for the workstation from which the program is called!

Finally, to complete the installation, you can make it so that you do not have to first go to the directory where the launch script is located each time you launch Acrobat Reader. To do this, you need to create a link to this script in one of the directories specified in the $PATH variable. For example, let's create the following link in the /usr/bin directory:

# ln -s /usr/locale/Acrobat4/bin/acroread /usr/bin/acroread

In order to conveniently launch the program in a graphical environment, all that remains is to create an icon (“icon”) on the desktop (if you don’t remember how to do this, see the description of the graphical environment you are using) and the installation process of the program can be considered complete .

Now you can launch Acrobat Reader (of course, this must be in graphical mode) using the acroread command or by clicking on the icon on the desktop.

$ /usr/local/Acrobat4/bin/acroread

In order to view a specific file or even several using Acrobat Reader, you can immediately specify the names of these files on the command line. For example,

$ acroread /user/share/docs/Samba/Collection.pdf

Rice. 12.1. Acrobat Reader window

If you issue the acroread ‹filename› command while Reader is already running, the active copy of Reader will display the specified file.

If you want to get help using the program, enter one of the commands

With Acrobat Reader, you can convert PDF files to Level 1 or Level 2 PostScript files, as long as you do so from a graphics mode command line. To do this you need to run approximately the following command:

$ cat sample.pdf | acroread -toPostScript › sample.ps

Using similar commands (a more detailed description of which you can find in the program documentation) you can convert a group of files at once.

To convert a PDF file back to a Level 2 PostScript file, type the following command:

$ acroread -toPostScript -level2 pdf_file_1

I will not describe in detail all the menus and capabilities of the Acrobat Reader program, since it is widespread and familiar to many readers. It’s better to take a closer look at specific Linux file viewers.

12.2.3 gv program

The gv (or ghostview) program was developed by Johannes Plass and is designed for viewing PostScript and PDF files (Fig. 12.2).

After launching it without specifying a file name, the main program window will be empty. To open a file, you need to click on the key Open in the left column. A file selection window will appear (Fig. 12.3), with which you can navigate through the directory structure and select the desired file. After this, the file name will appear in a special field in the upper frame of the main program window. Several program control buttons are also displayed there, which form a kind of menu. Just to use this menu, you don’t just have to click on the buttons, but hold down the left mouse button.

Using a button File you get access to items Open(same as the button mentioned above Open in the left vertical column), Reopen(Reread) Print document(Print document), Save document(Save document).

Button State(Status) allows you to enable or change some program parameters, in particular, access a separate program settings window shown in Fig. 12.2.


Rice. 12.2. gv program window

Button Page serves to move to the next or previous page of the document. The same transitions can be made using two small buttons, indicated by the symbols ‹‹ and ›› in the left vertical column. Next to the button Page There is a button that does not have a permanent name, because it serves to set one of 4 possible text output orientations. Text can be displayed on a page oriented in the usual way (Portrait), rotated 90 degrees (Landscape), 180 degrees (Upside-Down, i.e. upside down), 270 degrees (Seascape).


Rice. 12.3. Window for selecting a file to view in gv

Rice. 12.4. gv program settings window

The next button is used to set the image scale, which is indicated on this button. Another button is used to select the paper size. This is necessary for organizing printing, because the gv program is a means for previewing what will appear on paper.

There is another interesting thing in the left column: a gray rectangle above the ›› and ‹‹ buttons. Inside this rectangle there is another rectangle that can be grabbed with the mouse and moved within the outer rectangle. Do this and you will understand the purpose of this element: to display different parts of the page in the viewport.

12.2.4 PS, PDF and DVI file viewers from KDE

The user interface of the gv program is somewhat unusual for a person who has only worked with Windows. Meanwhile, the KDE integrated graphics environment includes two programs with a more traditional appearance. These are the “PS/PDF Viewer” and the “DVI Viewer” (as these programs are called in the headers of their own windows and in the KDE menu). Their interface is very similar and this is explained by the fact that they work through the same shell - KviewShell. However, in the KDE menu they are listed as separate programs, and each of them displays its own name in the window title.

Comment:

Here it can be noted in passing that in UNIX this technique is very often used: a “workhorse” (back-end) is created, for which beautiful shells (front-end) are then written for different cases, for example, for text and graphical modes or for different library options. You will come across examples of this approach more than once, even while reading this book, although I will not highlight these points separately.

In Fig. Figure 12.5 shows the appearance of the window of the PS/PDF Viewer program (developed by Wilco Greven, David Sweet, Mark Donohoe, David Faure, Daniel Duley and Espen Sand.), otherwise called Kghostview, which apparently indicates its origins in program discussed in the previous subsection. The relationship with the previous program is also indicated by the fact that almost all menu items repeat similar gv items, only the menu is organized slightly differently. This can also be seen from the figure. There is no point in talking about the program in more detail; it is enough that you know about its existence. And you can easily learn to use it on your own.


Rice. 12.5. Appearance of the PS/PDF Viewer program window.

I will also not talk about the DVI Viewer program, limiting myself to the already mentioned mention of it and the message that it is intended for viewing DVI format files created by the TEX layout system.

12.2.5 WordViewer package

As mentioned above, one of the biggest problems for Linux users is working with files in MS Word (and other MS Office programs) formats. After all, so far most texts are created in this format. The most common means of viewing such files is the program (more precisely, a library of programs) wv, which previously bore the more complete name mswordview.

The wv library is intended for accessing files in MS Word 2000, 97, 95 and 6 formats from UNIX operating systems, in particular from Linux. The ALT Linux Junior 1.0 distribution includes version 0.6.5 of this package, authored by Dom Lachowicz and Caolan McNamara (the original developer). If you do not have this package installed, you can find it at http://www.wvware.com.

The idea implemented in this package is very simple: since we do not have the means to view files in MS Word format, then let's convert the text from these files into some open format. As the latter, you can choose one of the following formats: HTML, PS, PDF, LaTex, DVI (TEX publishing system format), ABW (AbiWord text editor format), Wml (format used in personal PDA organizers and devices such as Web phones) , ASCII text. Calls to individual library procedures can be used in other applications. The developers promise that the reverse conversion will soon become possible: from the listed open formats to the MS Word format.

The package consists of separate programs, each of which is designed to convert a doc file into a specific format. This format is indicated directly in the names of individual programs in the package: wvAbw, wvCleanLatex, wvDVI, wvHtml, wvLatex, wvMime, wvPDF, wvPS, wvRTF, wvSimpleCLX, wvText, wvWml. In addition, the package includes two auxiliary utilities: wvVersion, which is used to obtain information about the version of an MS Word document, and wvSummary - this utility displays general information about the document, which can be entered in MS Word itself through the menu item File | Properties. This is what the output of these commands looks like (for the file I used in this example, the service data was not entered; however, if you enter them in Russian, then there will be not much more joy, since the output will be in the CP-1251 code page, so the text is in the screen will be unreadable).

$ wvVersion book-p1.doc
$ wvSummary book-p1.doc
The keywords are no comments found
The app name was Microsoft Word 8.0

The main utility of the package is the wvWare (or wvConvert) program, which is called as follows

wvWare filename.doc › filename.html

Main options:

Indicates the output filter being used.

Sets the code page for iconv.

Sets the password for encrypted Word documents.

Specifies the directory in which the generated graphics will be saved.

Returns the wvWare package version.

Displays brief help on using the program.

The output filter, specified by the -x or -config= option, specifies the output file format. If this option is not specified, then the output filter is searched in the current directory or (if not found in the current one) in the location where the package is installed. By default, the wvHtml.xml filter is used, i.e. the doc file is converted to HTML format.

After conversion, the resulting file can be viewed using an appropriate viewer, for example, an html file using any Web browser. Of course, some of the formatting capabilities found in Word are lost, and this must be kept in mind when viewing the resulting files.

As far as I can tell, it is the wv package programs that are used to open MS Word files in some text editors for Linux, for example, AbiWord.

12.2.6 Code page transcoder programs

As you know, there are several alternative encodings or code pages for representing characters of the Russian alphabet.

On Unix systems, the most common encoding is KOI8-R; Microsoft uses CP-1251 or CP-866 (DOS). There are also ISO8859-5, UTF, Unicode (you can read more about encodings in Section 9.3).

If you encounter a file whose contents are “unreadable,” then you will need a transcoding program. As they say in RU.LINUX.FAQ: “There are simply a huge number of CP1251 and CP866 -› KOI8-R transcoders. No need to write new ones;-). The most widely used are iconv (included in the glibc distribution) and GNU recode.”

The iconv program is launched as follows:

$ iconv -f866 -tKOI8-R -o ‹outfile› infile

If you do not specify the output file (option -o), the result will be displayed on the screen (using the more or less filters you can conveniently view the file). To get a list of all possible encodings (and it is huge!), issue the command iconv -list, and for help: iconv -? or iconv -usage. By the way, the man page is not displayed. However, there are still very few other options: only -verbose (provide additional information), -V, and -version (both options are used to display the program version).

The recode program can be found at http://www.iro.umontreal.ca/~pinard/recode/.

It starts something like this:

$ recode CP1251..KOI8-R winfile.txt

In addition to the commands mentioned, you can use the "Russian Anywhere" program, which exists both in a version for Windows (where I got acquainted with it) and in a version for the Linux command line (the creators promise to release a graphical shell). This program can be downloaded (both in source code and as an executable module) from the developer’s website http://www.livotov.org/software/.

The executable module of the program is called re. It is better to place it in one of the directories specified in the PATH variable.

The program is called from the command line. In order to recode some file that is “unreadable” into KOI8-R encoding, you need to issue the command:

$ re ‹SourceFile› ‹DestFile›? K

‹SourceFile› - source (unreadable) file;

‹DestFile› - recoded file;

Tells RE that the encoding of the source file is unknown and re must analyze the file and determine its encoding itself;

K - specifies the encoding for the resulting file (in this case KOI-8).

If you know the encoding of the source file, you can specify it instead of the "?" character. For example, if you want to transcode the letter.txt file that was created in Windows, and you know that the file was saved in 1251 encoding, then you would issue the command:

$ re letter.txt letter-koi.txt W K

After that, by looking at the letter-koi.txt file, you will see quite readable Russian text in KOI8-R.

Full format for calling the transcoder:

$ re options filename_from filename_to cp_from cp_to

where options: [-v][-E|-R|-N][-e|-s]

V - provide information about the progress of processing;

N - do not provide information about the processing progress (set by default);

E - convert all characters p, H from Russian to English;

R - convert all characters p, H from English to Russian;

N - leave all p, H (Russian and English) as in the source text (set by default);

E - recode all characters 0x80 - 0xFF;

S - transcode only 64 characters of the Russian alphabet (set by default),

and cp_from and cp_to are any of the following characters indicating possible encodings (default is W,K).

Table 12.1. Designation of encodings in the program re.

Symbol Encoding Symbol Encoding
W Windows _ (underscore) _xxe
D Dos % %hex
K KOI-8 \\ \"hex
L Latin G Graph_win
I ISO binhex
H HEX + +UTF7-
S ShiftKbrd C C_MIC
M Mac Y Y_c16
A AFF Z Z_c32
O Odd(UTF8_1) F F(UTF8_2)
B Base64 P Pict
E Express N N_Estl
T T-Html V V_Vpp855
U User X X_sp
- (dash) uue J J_diff

As already mentioned, if cp-from="?", then the program tries to independently determine the encoding of the source file.

If for some reason you do not have any of the specified transcoding programs, then to view the contents of the file you can use one of the Internet browsers, which are initially designed to work with different encodings. For example, regular lynx will do:

$ lynx -assume_local_charset cp866 file.txt

You can also load an “unreadable” file into Netscape Navigator, and then change the encoding through the menu View/Character Set.

12.3. Spell check

Before we look at text editors for Linux, we need to briefly look at the ispell spell checker. The fact is that spell checking is one of the functions that a modern text editor should have, and many of them use ispell (or aspell) to perform this function. There is a Russified version of this program, which was developed by Vladimir Roganov and Konstantin Knizhnik.

Installing ispell consists of two stages: first you need to install the program itself, and then install the Russian language dictionary. To install the ispell program itself, I used the ispell-3.1.20-23.i386.rpm package, and to Russify it, I used the ispell-russian-3.1.20-23.i386.rpm package. Both packages were included in the Black Cat Linux 6.02 distribution. To install the first package, just give the command

# rpm -i ispell-3.1.20-23.i386.rpm

and for the second - the command

# rpm -i ispell-russian-3.1.20-23.i386.rpm.

After this, the Russian dictionary files russian.aff and russian.hash will appear in the /usr/lib/ispell directory (other dictionaries, for example, German) can be deleted if you do not intend to check spelling in these languages.

To check the text, you now just need to issue the following command:

$ ispell -drussian edit.htm

Naturally, the file name edit.htm is taken here as an example; you must substitute the name of the file that you want to check, and the file must be in the current directory, otherwise you must specify the full file name with the path.


Rice. 12.6. Spell checking with ispell

The principle of operation of the ispell program is very simple: every word found in the file must be in the program's dictionary. If a word is not found in the dictionary, it is considered that an error has been found, and a message is displayed on the screen, an example of which can be seen in Figure 12.5. The top line displays the detected erroneous word and the name of the file being checked. Below are several lines (the number can be specified) from this file containing the detected error. If words similar to the incorrect one are found in the dictionary, they are displayed below (with serial numbers). This is followed by a hint line and the command line of the program.

From the Command Prompt at the bottom, you can use the following keyboard commands.

Table 12.2. Replacement commands in the ispell program.

Team Action to be performed
‹R› Replace the wrong word (the program will prompt you to type the correct word in the bottom line of the screen)
Skip this occurrence of a word
‹A› Skip all occurrences of a given word in the current session of working with the program
‹I› Skip this word and include it in the personal dictionary (which is stored in the .ispell_russian file in the user's home directory
‹U› The same thing, only the word is written in lowercase (small letters)
‹Q› Immediate exit from the program (confirmation is first requested, and the file being checked remains unchanged; any changes made are not carried out)
‹X› Abort the scan, record the changes made and exit the program
‹!› Temporary exit to shell

If you enter as a command the serial number of one of the replacement options proposed by the program, the program will replace the erroneous word with a word corresponding to the typed serial number of the replacement option. Only the numbers must be entered exactly as they are suggested by the program, i.e. with zeros preceding the significant digits (if any). And you must dial the number without first entering the command ‹R›, otherwise the erroneous word will be simply replaced with the corresponding number.

The ispell program, as already mentioned, is used as a spell checker in many text editors, for example, in Emacs it provides spell check directly during the text preparation process.

If you think about the checking principle inherent in the program, it is easy to understand that with its help you can check only a very limited class of errors, namely spelling errors, which consist of incorrect spelling of words. Obviously, no errors in grammatical structures, word agreement, etc. will be detected.

Another drawback of the program that I encountered occurs in cases where there is little free space on the current disk, less than what is needed to write the corrected file. In this case, the program writes only that part of the file that fits and loses everything else. No warnings are issued in this case.

If there is no lack of disk space, then after making corrections the program writes the corrected version of the file, and saves the original file by adding the .bak extension to its name.

12.4. About the three types of text editors

Editing text files (with texts in natural language or with program texts) is one of the most frequently performed jobs on any computer and in any operating system. Maybe that’s why so many text editors have already been developed for Linux (about 100 titles are listed on www.linuxlinks.com, and that’s probably not all). So there is plenty to choose from. And it’s worth spending some time choosing the optimal editor.

Of course, for such a choice to be justified, ideally you need to try all the editors or most of them. This is obviously impossible, so you have to rely either on chance or on the opinion of someone you know or the authors of computer books. (By the way, a good review of text editors, in my opinion, is contained in A. Fedorchuk’s book “Office, Graphics, Web in Linux” [P1.6]. I will also try to express my impressions of some text editors for Linux.)

Of the many different text editors, the average user usually chooses two or three with which he constantly works. He learns control key combinations to the point of automaticity, gets used to performing standard editing operations in a certain way, through menu items or mouse clicks, and, in general, adapts to the editor environment. Therefore, there must be sufficiently compelling reasons to change the editor.

In my opinion, an average user who often uses a computer to edit files needs to master at least 3 editors.

One of them is a powerful word processor that works in WYSIWYG mode, providing extensive text formatting options and a lot of additional features not found in simpler editors. To this type I would include text editors (processors) from the StarOffice, Applixware, KOffice packages, individual word processors Maxwell and WordPerfect 8, AbiWord, as well as the TEX publishing system. I will call all editors of this type word processors. True, some authors, for example, the same A. Fedorchuk, still divide them into simply editors and processors, but I see no reason for this. Strictly speaking, the whole question is in the text formatting capabilities that the editor provides. And it is difficult, if not impossible, to propose any exact criterion for dividing editors of this class into two subclasses.

The second necessary editor is an editor for creating or editing ASCII files, working in graphical mode. Using this editor, a Webmaster can, for example, edit html pages, write a letter in it for subsequent sending by e-mail, etc. This should be a graphical mode editor, because in many cases it is easier to work in graphical mode and more convenient than text. Examples of such editors are KEdit and KWrite from KDE, nedit.

And yet you must be able to use one of the console text editors, because you, as the only user (and even superuser) of a personal computer, must be able to edit configuration files, in any situation, even when the graphical mode does not load. The choice of editors of this type is very wide: vi, vim, bvi, Nvi, Elvis, Levee, vile, Wily, joe, aee, Fred, gred, le, lpe, Zed, Emacs, CoolEdit. Long-time UNIX devotees most often use vi or its improved version vim, but those switching to Linux from a Windows environment will find it easier to master CoolEdit, which is very similar to the built-in editors for Norton Commander and FAR.

Based on these considerations, the following presentation is divided into three large parts, each of which is devoted to one of the identified types of editors. The first version of the section with a description of each editor discussed below was created in the very editor that is described in this section (these first versions were posted by me on the website http://linux-ve.chat.ru). I hope that after reading these sections you will be able to decide on the choice of text editors. Of course, everyone may have their own selection criteria. But I think that for us, Russian-speaking users, an important factor is the ability to enter and edit texts in Russian. It is also desirable that the menu items and program messages are also Russified (however, to some extent you can put up with English terms here, especially if there is a good description of the program in Russian, because the number of menu items is usually small and their meaning can simply be remembered).

12.5. Console ASCII file editors

Let's start by looking at text mode editors, i.e. those working in the console. Speaking about such editors, it is simply impossible not to mention the editors vi And Emacs, but the built-in Midnight Commander shell editor will be considered more thoroughly - Cooledit.

12.5.1 Editors like vi

The vi editor (or its slightly modified descendants) is included by default in any UNIX-like system, including all Linux distributions. All UNIX fans who have significant experience working with these operating systems know and use this editor. Editor description vi you can find, if not in any, then certainly in most books on UNIX. From the editor vi there are several descendants who improve and improve it in some way. These are editors like Vim, bvi, Nvi, Elvis, Levee, vile, Wily(editor Vim even called on Linux by command vi). A brief overview of editors of this class can be found in the article by A. Fomichev “Text editors for UNIX OS” (Open Systems, No. 4, 1994). However, for those users who migrated to Linux from a Windows environment, all these editors are unlikely to seem convenient. The reason is that these editors do not have the usual menus and prompts (as far as one can judge from Vim version 5.3) and you need to remember a lot of keyboard shortcuts to enter commands. At the same time, work in the editor is organized in the form of two separate modes - text entry and command entry, and a beginner often simply confuses the modes. In general, I would not recommend that you undertake mastering editors of this type without a printed manual. And although those who have mastered vi often resort to its help for editing simple files (especially configuration files and scripts), I believe that there are more convenient tools, and therefore I do not consider editors like vi(although I couldn’t help but mention them).

12.5.2 Emacs editor

The most famous among editors used in Linux is Emacs. It exists in both text mode and graphical shell versions. Some even say that Emacs- this is not an editor, but a way of life, and in another source it is called a religion. If you would like to get to know each other better Emacs, I can recommend to you the recently published Russian translation of R. Stallman's book about him; look for this book, for example, in the Bolero virtual store. You will find an excellent introductory description of this editor in A. Fedorchuk’s book “Office, Graphics, Web in Linux”. However, I believe that for novice users it is advisable to use CoolEdit- built-in editor for the Midnight Commander file manager.

12.5.3 CoolEdit - built-in editor of the Midnight Commander program

CoolEdit is an easy-to-use program with control key combinations familiar to most users (especially those who have worked with Norton Commander under DOS or FAR under WINDOWS). In addition, we must take into account that usually any work with a file begins with the file manager, since first you need, at a minimum, to find the file. Midnight Commander is just such a file manager, and the transition to editing is carried out by simply pressing the ‹F4› key after setting the highlight to the name of the found file. It's a small thing, but convenient. Taking into account the above considerations, I will begin a detailed story about text editors with CoolEdit.

The built-in Midnight Commander editor (Fig. 12.7) is called while working in this program by pressing the ‹F4› key, provided that the “use_internal_edit” option is set to 1 in the Midnight Commander initialization file. It can also be called independently of Midnight Commander simply from the command line, with the command mcedit. However, its true name is still CoolEdit, you can verify this if you press the ‹F9› key in edit mode and open the menu item File | About the authors.


Rice. 12.7. Cooledit editor window appearance

This editor provides most of the editing functions found in full-screen text editors. With it, you can edit files of almost any size, since the upper limit for the size of an edited file is 16 MB. Enables editing of executable (binary) files without data loss.

The following features are supported:

Copy, move, delete, cut and paste blocks of text;

Cancel previous operations (using the key combination ‹Ctrl›+‹U›);

Drop-down menus;

Inserting files;

Macro definitions;

Search and replace using regular expressions (in other words, patterns formed using special characters), as well as its own version of search and replace operations based on the scanf-printf functions;

Selecting text using the key combination ‹Shift›+‹arrows› in MS Windows - MAC style (only for Linux console);

Switching between symbol insertion and replacement modes.

The editor is very simple and requires virtually no training (especially since you can find versions in which the main part of the menu items is Russified; such a version was included, for example, in the Black Cat 5.2 distribution). In order to find out which keys cause certain actions to be performed, just look at the drop-down menus called up by pressing the ‹F9› key in the editor window (Fig. 12.8).


Rice. 12.8. Exit to the Cooledit menu using the ‹F9› key

If you are working in a Linux console, you can use the following keyboard shortcuts to work with blocks of text: ‹

Shift›+‹arrow keys› - selecting a block of text;

‹Ctrl›+‹Ins› - copies the block to the file cooledit.clip;

‹Shift›+‹Ins› - inserts the last block copied into cooledit.clip at the cursor position;

‹Shift›+‹Del› - deletes the selected block of text, storing it in the cooledit.clip file.

If you have the program installed gpm- mouse driver for the console, then you can click on the left mouse button at the beginning of the selected block, move the cursor to the end of the block and release the button (thereby selecting the text), and then move the cursor to where you want to insert the fragment and click on the right button mouse to paste the selected text.

The editor supports macros. To define a macro, press ‹Ctrl›+‹R›, then enter the strings of commands that should be executed. After finishing entering commands, press ‹Ctrl›+‹R› again and associate the macro with a key or key combination by pressing that key (combination). The macro will be called by pressing ‹Ctrl›+‹A› and the key assigned to it. A macro can also be called by pressing any of the ‹Alt›, ‹Ctrl› or ‹Esc› keys and the key assigned to the macro, provided that this combination is not used to call any other function.

Macro commands, once defined, are written to the file cedit/cooledit.macros in your home directory. You can remove a macro by deleting the corresponding line in this file.

When performing replace operations (function key ‹F4›), you can use scanf's search and replace functions to search and replace according to C language format patterns. First look at the sscanf and sprintf man pages to learn what format patterns are and how they work.

Here's an example: Let's say you want to replace all occurrences of blocks of text consisting of an open parenthesis, three comma-separated numbers, and a closing parenthesis with a block consisting of the word apples, the third number from the original block, the word oranges, and then the second number from the original block. Then in the dialog box that appears when you call the replacement command (‹F4›), you need to set the following templates:

Enter replace string apples %d oranges %d
Enter replacement argument order

The last of these lines says that the third and second numbers should be substituted in place of the first and second arguments. It is still recommended to use the “Prompt on replace” option when performing a replacement, because the program considers as matches all cases where the number of arguments matches the specified number, although this does not always mean a complete match. Scanf also doesn't pay attention to the number of whitespace characters.

The built-in editor processes characters from the second half of the code table (160+). But when editing binary files, it is better to set the option Character bits(Display bits) from the menu Settings to the "7 bit" position to preserve the file format.

It would take too much space to describe all the functions of the built-in editor here. Yes, there is no need for this, since to use it it is enough to remember that all basic operations can be performed through menu items, which are called up by pressing the “F9” key in the editing window. You can also read the man page using the command man mcedit or info mcedit.

To conclude this brief reference on the built-in editor of the Midnight Commander program, I would like to talk about how text fragments are transferred from one file to another.

If you work in the console, then this task is solved through the menu or using the following operations:

Mark the beginning of the block using the ‹F3› key;

Move the cursor to the end of the block;

Mark the end of the block using the ‹F3› key;

Type the combination ‹Ctrl›+‹Insert›;

Close this file and open another one;

Place the cursor where we want to insert this fragment and press the key combination ‹Shift›+‹Insert›.

That's it, task completed. A fragment of text can be transferred using this method from one virtual console to another.

But all this only works in the console. And when working with the same editor in a graphical shell window, the same task was a problem for me for quite a long time.

I didn’t immediately find a way to solve it (i.e., transfer a piece of text), which works both in the console and in the graphical shell window. This method consists of transferring a piece of text through another file (the default is ~/.cedit/cooledit.clip). Select a piece of text, select a menu item File | Copy to file(File | Copy to file) and press ‹Enter›. Then go to another file, place the cursor where you want to insert the fragment, and select the menu item File | Insert file(File | Insert file).

12.6. ASCII file editors for graphics mode

Obviously, it would be very convenient if editing ASCII files in graphical mode was carried out using the same editors that are used in console mode. Then you wouldn’t have to learn other key combinations or change your usual environment. The CoolEdit editor, which was described in the previous subsection, can be launched through a terminal emulator and thus used in graphical mode. However, it turns out that some key combinations in the emulator do not work or work differently than in the console. In addition, working with the mouse in editors that are initially oriented towards graphical mode is organized much better than in console editors, which increases the overall ease of use (although this may be purely my subjective feeling). Therefore, I still recommend not limiting yourself to using only a console editor for ASCII files, but mastering one of the many editors aimed at processing such files in graphical mode. Let's look at three similar editors.

12.6.1 KEdit editor

The editors KEdit and KWrite are part of the KDE graphical environment. They are designed to run in graphical mode, but work with ASCII files. The editors are very similar, so I'll talk about KEdit first, and then just point out the differences in the second editor.

The KEdit editor is very easy to use and, if you have ever edited text, you will not have any problems with it. In addition, if you have already Russified KDE, then you will not have any problems with entering and displaying Cyrillic characters. Moreover, the program menus and messages are also Russified.

You can open a file for editing through the menu or using the combination ‹Ctrl›+‹O›. A window appears in which you can select a file to edit. Everything is familiar here, and I think you don’t need any additional explanations. In addition to this method, when working in the KDE environment, you can use the "Drag and Drop" method. This means that from the Konqueror file manager you can grab a file with your mouse and simply “throw” it into the KEdit window.

Basic editing operations are performed using the keyboard. The ‹Insert › key switches between the modes of inserting and replacing characters. Moving through the text is carried out using the arrow keys and the ‹Page Down›, ‹Page Up›, ‹Home› (go to the beginning of the line), ‹End› (go to the end of the line) keys. You can select a block of text (unfortunately, only linear) using the mouse or using the arrow keys while holding down the ‹Shift› key. The ‹Delete› key deletes the character to the right of the cursor or the selected block of text.


Rice. 12.9. KEdit editor window.

In many editors, including KEdit, text moving and deleting operations can also be performed using hotkey combinations (perhaps due to the fact that older terminals did not have arrow keys?):

‹Ctrl›+‹A› - move the cursor to the beginning of the line.

‹Ctrl›+‹B› - move the cursor one character to the right.

‹Ctrl›+‹E› - move the cursor to the end of the line.

‹Ctrl›+‹N› - move the cursor one line down.

‹Ctrl›+‹P› - move the cursor one line up.

‹Ctrl›+‹D› - delete the character to the right of the cursor.

‹Ctrl›+‹H› - delete the character to the left of the cursor.

Basic commands for moving blocks of text from one place to another are carried out using the same combinations that are used in the editor from Midnight Commander and many other editors, so that your fingers find these combinations automatically:

‹Ctrl ›+‹C› - copy the selected text to the clipboard;

‹Ctrl›+‹X› - cut the selected text fragment and place it on the clipboard;

‹Ctrl›+‹V› - paste a piece of text from the clipboard to the cursor position;

‹Ctrl›+‹K› - delete text from the cursor to the end of the line and place it in a special buffer (kill-buffer);

‹Ctrl›+‹Y› - paste a piece of text from a special buffer at the cursor position. Using the combination ‹Ctrl ›+‹ J› you can format the current paragraph of text. Formatting, however, consists only in the fact that very long lines of text are divided into those whose length does not exceed the value specified in the corresponding option in the Settings menu item.

The combination ‹Ctrl›+‹F› calls the substring search function.

To save the editing results in a file, you can use the menu item File | Save or the combination ‹Ctrl›+‹S›. If you want to save the edited text in a file with a different name, then you need to act only through the menu ( Save as).

KEdit supports printing. You can print the entire edited file or a selected piece of text. Printing is done to the default printer. Additionally, you can connect any of the printing utilities, which are widely developed for UNIX.

What particularly impressed me when I first discovered KEdit was its built-in spell checking capability and the ability to view and edit files in both CP-1251 and koi8-r encoding.

To change the encoding you need to play with the selection of fonts in the menu item Settings | Font. Unfortunately, not all fonts support both encodings, but after several attempts you can select the right font. To check spelling, just select the menu item Editing | Spell check. Naturally, the ispell program must be installed on the system, and, in addition, before starting the scan, you should enter the menu item Settings | Spell check and select the Russian dictionary and the desired character encoding (see Fig. 12.10).

By the way, menu item Settings In general, it is advisable to take a closer look before editing any files, select the settings you need, and then save them (subsection Record settings).


Rice. 12.10. Setting up spell checking in KEdit

Another nice, in my opinion, built-in feature of the KEdit editor is the ability to call the mail program directly from the editor. I could not test the operation of this function, since I have nowhere to send letters on my home computer (isolated). But I often use this function at work, in MS Word, and I find it very useful and convenient.

In general, this editor made the most favorable impression on me from the first time I met him, so I recommend that you get to know him better. You might even choose it to edit ASCII files when working in graphical mode.

12.6.2 KWrite Editor

The KWrite editor, as already mentioned, is very similar to KEdit. The first difference that catches your eye after loading a file into the editor is the coloring of function words. Coloring is specified by subparagraphs Set coloring And Coloring… point Settings. Since I often edit HTML files, I found this feature convenient.

One new item has appeared in the main menu - Bookmarks with subparagraphs Set bookmark(‹Alt›+‹S›), Add a bookmark And Clear bookmarks(‹Alt›+‹C›). The rest of the main menu items are the same as those in KEdit.

There is a rollback function ‹Ctrl›+‹Z› and the ability to select a vertical column (this function is activated by pressing the ‹F5› key). Using the key combination ‹Ctrl›+‹I›, an indent is inserted into the current line (a space is added to the beginning of the line). Using the key combination ‹Ctrl ›+‹U›, the indentation is removed (and if there was no indentation, the first character of the line is silently deleted).

Perhaps this is all that is new in KWrite compared to KEdit. But, unfortunately, some useful functions are missing. In point File The item regarding sending a file by email has disappeared. In point Edit There is no option to insert a date. The ability to select a font in the Setting | Setting up KWrite, which I consider the biggest drawback of this program.

Otherwise, these editors are almost the same, so you can work with any of them. I think that over time, all the features of KEdit will be included in KWrite, and it will become the "standard" text editor of the KDE shell.

12.6.3 Text editor Nedit version 5.1.1

The Nedit text editor was created by a group of authors led by Mark Edel, is distributed under the GPL license, and can be obtained from the Web site http://nedit.org. Outwardly, it is very similar to the two editors described in the previous section, but it has much more capabilities than KEdit or KWrite.


Rice. 12.11. Appearance of the Nedit editor window

After my first acquaintance with this editor, I decided to stop using KWrite and switch to Nedit. A. Fedorchuk [P1.6] also believes that Nedit is approaching the ideal of a text editor, and even calls it “the best editor of all times.”

Perhaps the only (in my opinion, not very significant) disadvantage of Nedit compared to KEdit or KWrite is that menus, messages and tips are presented in English. True, there is no such item in the menu as sending an email message, but it is possible to execute any shell command or create a macro, which more than makes up for the lack of a direct call to the email program.


Rice. 12.12. Window for setting fonts in Nedit

Switching the editor to enter Russian text was not difficult for me. To do this you need to enter the menu item Preferences/Text Fonts… and set the required fonts in the input lines of the corresponding window (see Fig. 12.12). And, since it is quite difficult to remember these long lines with font names, you can use the Browse... button and select a font from the displayed list (see Fig. 12.13). You need to choose a font that has the KOI8-R encoding. Please note that to select a font, you must check one option in each of the three proposed columns, otherwise you will most likely receive a message stating that the font is not available.


Rice. 12.13. Choosing fonts in Nedit

Considering that, due to quite a long period of using editors such as the FAR file manager editors for MS Windows and Midnight Commander, I have developed strong habits of using certain key combinations, I was very pleased to discover that for cutting, copying and pasting blocks of text Nedit uses the familiar combinations ‹Ctrl ›+‹X›, ‹Ctrl›+‹C› and ‹Ctrl›+‹V›. Selection of a block of text is carried out either with the mouse or with the arrow keys while holding down the ‹Shift› key. If you hold ‹Shift›+‹Alt›, a rectangular column will be selected. Operations with selected blocks can be done not only using the keyboard, but also through menu items Edit. This is convenient if you do not remember the key combination to perform the intended operation. But old habits do not always help, in particular, to cancel the last operation in Nedit, you use not ‹Ctrl›+‹U›, but ‹Ctrl›+‹Z›.

In the same menu Edit there are two subparagraphs ( Lower-case And Upper-case), with which you can convert the text in the selected block, respectively, to lower and upper case.

Paragraph File The main menu contains sub-items with which you perform the usual operations of opening and saving edited files. Please note that using the subparagraph Open Previous you can easily return to editing the files you worked with in previous sessions. Sub-clause Include file...(‹Alt›+‹I›) allows you to paste the contents of the selected file at the cursor position, sub-item Print… serves to output the edited file to the printer.

Paragraph Search The main menu contains calls to search and replace operations, as well as quickly jumping to the desired line or to a previously made bookmark (and setting such a bookmark).

To customize the program according to your tastes and habits, use the menu item Preferences. I have already told you how to select a font for displaying text in the program window. Here you can use the command Language Mode select a language (for example, html or C), according to the rules of which text elements (function words or tags) will be highlighted, set the tab size ( Tabs…), as well as enable or disable text line numbering, statistics line display, syntax highlighting, file backup mode, symbol insertion/replacement mode.

Paragraph Shell used to run shell commands and external programs. Here you will find, in particular, a call to the spell checker ispell, but there is no way to connect a Russian dictionary through the program menu. But this difficulty is easily overcome by using a .nedit resource file in the user's home directory. Enough in the line defining the program call ispell, add the -d russian parameter and checking Russian-language texts will work (in a separate terminal window).

Through the same ~/.nedit file you can configure the background and text colors, the geometry of the program window and some other parameters. The same can be done in a special section of the .Xdefaults file in your home directory. True, there is no such section in this file by default, but it can be created, as recommended in the book by A. Fedorchuk.

But let's get back to the menu items. Paragraph Windows serves to switch between windows (of which several can be opened at the same time). Purpose of the item Help, I think, is clear without further explanation. Unfortunately, the hint is given in English and there is no search for hints using keywords and phrases.

In this brief description I did not touch on the menu item Macro, as well as those sub-items of the main menu that are focused on actions performed when editing program source codes (for example, inserting ASCII codes, highlighting paired brackets, or compiling program code). But even based on what was said in this subsection, we can conclude that Nedit is a fairly powerful and convenient editor for working with ASCII files in graphical mode. If you want to know more about him, read A. Fedorchuk’s articles on the Internet or his book [P1.6].

12.7. Word processors

Let's agree that the term "word processors" will mean all programs for editing text files that work in graphical mode and use special characters or inserts to indicate formatting elements when saving the results of work in files. The word processor does not display these inserts as any characters during the editing process. In this sense, Nedit is not a word processor, but Netscape Composer is, because it displays formatting elements graphically, rather than as HTML tags.

12.7.1 Word processor capabilities

Standard text formatting tools include:

Ability to select different fonts for different parts of text in one document;

Setting the width of the fields, the amount of indentation, intervals;

Organizing text in columns;

Inserting figures and tables into the text;

Possibility of creating inscriptions at an angle to the line or in a curved shape;

Spell check (for user language)

In order for a word processor to be considered powerful and convenient, it must have the ability to process files created in other common word processors (Of course, this primarily refers to MS Word!). At a minimum, you need to be able to view documents in the formats of other editors. You can, of course, have transcoders, but from the point of view of ease of use, this is already a minus.

With this informal definition in mind, let's look at a few Linux software products that claim the lofty title of word processor.

Since, by their main purpose, text editors are closely related to language, and we are considering the case of the Russian language, when choosing a word processor, special attention must be paid to whether it has Russification capabilities. In order not to repeat the same thing when describing each of the products discussed below, I will immediately note that my system was installed not only with the standard Type1 fonts supplied with the Black Cat 6.02 distribution, but also with True Type fonts from Windows (see Chapter 11 ).

12.7.2 Word processors for Linux

There are many word processors for Linux. The most famous of them are StarWriter from the StarOffice package from Sun and the Word Perfect 8 processor. An analogue of the latter, developed for the Windows OS, competed on an equal footing with the MS Word package for a long time, which, of course, indicates its high quality. However, there are some problems with the Russification of the Linux version of this processor, so we are not considering it here.

A special place among word processors is occupied by the TEX publishing system and products like Lyx based on it. As for TEX, it is more of a programming language than a text editor. If you program in two or three different languages, you may have no problem mastering TEX. But a simple user who needs an editor to write business letters or a dissertation on the history of steam boilers, in my opinion, is hardly worth studying it.

12.7.3 Ted Text Editor

The Ted editor is conceived by the author (Mark de Does) as a simple text editor that runs under X Window on Unix/Linux systems, and plays approximately the same role as WordPad under MS-Windows, only with more features. The main advantage of Ted compared to the editors discussed in previous sections is the ability not only to enter and edit text, but also to provide basic text formatting options, change fonts, and insert tables and figures into the text. It is precisely because of the presence of these capabilities that I classified this editor as a word processor, although it does not have all the capabilities of developed word processors.

The package distribution can be downloaded from the website ftp://ftp.nluug.nl/pub/editors/ted or from the metalab server: //metalab.unc.edu/pub/packages/editors/ted.

The distribution comes either as a compressed tarball or as an RPM package. A Russified version of the editor can be found on the server ftp://ftp.logic.ru/ (of course, Russification is a little behind the versions).

I also installed the Russian version 2.6 of the Ted editor, but after a period of testing I returned to the English version 2.7, which is dated December 31, 1999, and which eliminated some of the shortcomings of the previous version.

After launching it, a window appears in which an engraving in the style of Albrecht Durer is shown, the version of the program is indicated, a link to the developers’ website and there are only three menu items: File, Window And Help. Obviously, in order to open an existing file for editing, you need to select the Open sub-item of the File menu and select the desired file in the window that appears. To create a new file, select the sub-item accordingly New menu File or type ‹Ctrl›+‹N›. After opening the file, the program window takes on the form shown in Fig. 12.14.

Ted supports the .rtf (Rich Text Format) file format, which allows for some degree of compatibility with Microsoft products. Namely, any file created in Ted and saved in rtf format will be correctly read by MS Word programs under Windows. Backward compatibility (that is, the ability to open any rtf file in Ted) is not achieved because some formatting options used in rtf files are not understood by Ted. However, the text of the opened file will be displayed in full, and can be saved in another (or the same) file, but without the formatting information that is ignored when opening the file.


Rice. 12.14. Ted editor main window

Here's a short list of Ted's main features.

Editing files in WYSIWIG mode. In this case, you can use all fonts for which you have .afm files and which are available for X11. Ted comes with .afm files for Adobe fonts, which are available for Motif-based systems and can be used with all postscript printers: Times, Helvetica, Courier and Symbol. Other fonts can be added using the usual procedures used for this in X11. Font properties such as bold, italic, underlining, superscripts and subscripts are supported.

Inserting pictures in bitmap format.

Printing on PostScript printers.

Working with files in Acrobat PDF format.

Spell checker for 12 languages ​​based on the Latin alphabet.

Send documents by e-mail without leaving Ted.

Cut/Copy/Paste operations, including sharing with other applications.

Search/Replace.

Formatting paragraphs: indent the first line, offset the entire paragraph, use rulers.

Splitting text into pages.

Inserting tables and operations with tables: operations with columns and rows of tables, resizing using rulers.

Inserting characters from different code tables is supported.

Saving a document in text and HTML format.

Ted can be used to read email messages sent from Windows machines. You can also configure Ted as an RTF file viewer for Netscape.


Rice. 12.15. Spell checking in Ted editor

I learned that Ted can be completely Russified from an article by Victor Wagner [P14.19]. The most interesting feature of the Russified version is the presence of a spell check for Russian-language text. This function is called using the menu item Tools | Spelling. In this case, an additional window appears (see Fig. 12.15), in which you need to click on the “Find next” button to search for the next error.

However, judging by the first impression, in the version that I saw (version 2.6), the implementation of this function has many shortcomings. Firstly, all words typed in Latin script are designated as errors (although even ispell ignores them without any problems). Secondly, words starting with a capital letter are perceived as errors (the program suggests typing such a word in all capital letters). And, what is most incomprehensible, a lot of correctly typed words are perceived as erroneous, and the very same word is offered as the first correction option.

However, there are many other errors. That is why I returned to version 2.7 and, following the recommendations of V. Wagner, tried to Russify it.

The first step is to teach Ted how to enter and display Russian letters. In order for Ted to correctly display fonts in koi8-r encoding on the screen, you need to create a file xfonts.dir in the /usr/local/afm directory, where Ted keeps font metrics (*.afm), placing the following text in it

Courier-Bold-*-courier-bold-r-normal--*-*-*-*-*-*-*-*
Courier-BoldOblique-*-courier-bold-o-normal--*-*-*-*-*-*-*-*
Courier-Oblique-*-courier-medium-o-normal--*-*-*-*-*-*-*-*
Courier-*-courier-medium-r-normal--*-*-*-*-*-*-*-*
Helvetica-Bold-*-helvetica-bold-r-normal--*-*-*-*-*-*-*-*
Helvetica-BoldOblique-*-helvetica-bold-o-normal--*-*-*-*-*-*-*-*
Helvetica-Oblique-*-helvetica-medium-o-normal--*-*-*-*-*-*-*-*
Helvetica-*-helvetica-medium-r-normal--*-*-*-*-*-*-*-*
Times-Bold-*-times-bold-r-normal--*-*-*-*-*-*-*-*
Times-BoldItalic-*-times-bold-i-normal--*-*-*-*-*-*-*-*
Times-Italic-*-times-medium-i-normal--*-*-*-*-*-*-*-*
Times-Roman-*-times-medium-r-normal--*-*-*-*-*-*-*-*

After this, Russian letters are entered and displayed normally. However, the problem is not yet completely solved: after working with Format tool or any dialog containing an input line, Ted again stops entering Russian letters. The solution to this problem, proposed by Ivan Pascal, is to create an empty file /usr/X11R6/lib/X11/locale/koi8-r/Compose and add it to the file /usr/X11R6/lib/X11/locale/compose.dir line:

This solution worked quite well for me (except that the Delete key stopped deleting characters and started inserting spaces, so I had to use the BackSpace key to correct errors).

Now let's look at adding new fonts. Only 4 fonts are supplied with the standard Ted distribution: Courier, Helvetica, Symbol and Times. If you want to add more variety to your documents, you'll need to add other fonts. In Ted, you can use any font that is visible in your graphical shell, but there are a few things you need to do to make it work. To find out what fonts you have, run xfontsel and select the font you want to add. Let's say this is Bookman Light.

In order for Ted to see the new font, you need to place the metric of this font (the metric is a file in the .afm format) in the /usr/local/afm directory. You can either find a ready-made metric or create it yourself. Ted is quite picky about font metrics. As V. Wagner writes, Ted for a long time refused to download fonts from kapella, since the afm file does not contain references to several characters appearing in Adobe Standard Encoding. At the same time, working with font metrics is a mandatory feature of a more or less advanced formatting program, since the information about the font that the X server provides is not enough for high-quality printing. If you try to work with Ted using metrics that don't match your fonts, the result will be ugly - words will run into each other.

Ready-made font metrics can be found in the Adobe base35 collection, which is located on the FTP server ftp://ftp.adobe.com, and instructions for installing them can be found in the Ted editor help file.

In conclusion, I note that Ted allows you to Russify the interface. It is enough to translate the resource file into Russian, which is located in the /usr/X11R6/lib/X11/app-defaults/ru directory and is called Ted. If there is no such directory, you need to create it and put all Russified resources there. After this, when running in the Russian locale, Ted will display all menus and most dialog messages in Russian.

12.7.4 AbiWord word processor

AbiWord is a small, fast, free and easy to learn and use word processor for X. The package can be downloaded from the Internet at www.abisource.com. After starting the program, you will see the main program window (Fig. 12.16), which strongly resembles the familiar MS Word window.

The AbiWord processor has all the features and functions that are inherent in word processors, including spell checking, which works directly as you enter text.

AbiWord allows you to open Microsoft Word format files (both MS Word 95 and MS Word 97) for editing and viewing. However, since to convert formats it uses calls to the procedures of the wv package, which we discussed above, all the disadvantages of the latter are reflected.

In native AbiWord format (.abw);

In text format (.txt);

In RTF format (.rtf);

In HTML format;

In UTF8 format;

In LaTex format.

Thus, in principle, through the RTF format it is possible to organize the exchange of files with MS Word users.


Rice. 12.16. AbiWord editor main window

Unfortunately, this editor is still under development (I looked at versions 0.7.8 and 0.7.14). When accessing some menu items, instead of the specified (or expected) result, a message appears stating that this item does not yet work. In version 0.7.8, this included features such as numbered list creation, styles, pagination, and character insertion. Instead of executing the corresponding function, the message “not implemented yet” appeared. And an invitation-request: if you are a programmer, join the development, and if you are not a programmer, then be patient. In version 0.7.14, some of these shortcomings have already been fixed, but some errors are still not fixed. In particular, if you simply highlight a directory in the file open dialog box and try to go to it by pressing the Enter key, a new instance of the program is called. True, the current directory for this new instance turns out to be the directory where we wanted to go, but opening new windows in vain is annoying (and resources are wasted). If you go to the directory by double-clicking the mouse, a new window does not open. There are other errors, and some of them simply close the editor, without warnings or saving the results of previous work. So it’s too early to consider this product ready for use.

However, overall it makes a very good impression and version 0.7.14 seems much more workable than 0.7.8. This indicates that work on the program continues. Therefore, let's be patient in the hope that the appearance of a full-fledged product that implements all the capabilities stated in the menu is not far off.

By the way, at http://www.hippo.ru/~hvv/abiword/ you can find a Russified version of AbiWord.

12.7.5 KWord word processor

The KWord word processor is part of the KOffice office suite. However, unlike StarOffice, it does not require the launch of a common shell or a common office desktop to run it. After starting the program (the easiest way to do this is from the main menu of the KDE shell by selecting Office | Word processor), an unassuming gray window appears (see Fig. 12.17), against the background of which a window for selecting the type of document to open immediately appears (Fig. 12.18).


Fig. 12.17. KWord start window


Rice. 12.18. Window for selecting the type of document to open

This window prompts you to either create a new document based on one of the templates, or open an existing document. Here you can also view the list of documents that you worked with in previous sessions and quickly call up one of them.

As soon as you call a document for editing, or open a new one, the appearance of the window changes dramatically (Fig. 12.19). New menu items and toolbars and page formatting lines also appear.


Rice. 12.19. KWord main window

Working with a new text editor usually begins with creating a new document, so let's create a new document and try to enter text. First you need to choose a font, naturally Russified. In KWord this is done through the menu item Format | Font. After selecting this menu item, a font selection window will appear (Fig. 12.20), in which we make this choice.

In the Russified version of Linux, among these fonts there are also fonts in the KOI8-R and cp1251 encodings. Select one of them and start entering text. By the way, the main characteristics of the font can be selected without looking at the menu, since the toolbar (Fig. 12.20) has drop-down lists for the font name, character size, icons for setting bold, underlined, strikethrough font, as well as for changing the color of characters and turning part of the text into superscripts and subscripts. However, icons on the toolbar can be added or, conversely, removed. But we’ll talk about toolbar settings later, but for now let’s get back to typing.

Rice. 12.20. Choosing a font in KWord

As soon as the first paragraph is entered, there is a desire to give it a nice appearance. What we will do using the menu item Format | Paragraph. A window with five tabs will appear, shown in Fig. 12.21. On the first tab, you can set indents for paragraph lines (separately for the first line and the rest), line spacing and spacing between two consecutive paragraphs. The size of all intervals and indents is specified in millimeters. The second tab sets the position of the lines of a given paragraph on the page: shifting them to the left, right, center, or evenly stretching them across the width of the page.

Tab Frame allows you to enclose a given paragraph in a frame (for example, to somehow highlight this paragraph from the general text). The last two tabs are used to set the format of lists and set tab stops, but we’ll talk about this later (if the opportunity arises).

Next item on the menu Format allows you to set the format of an entire page. After selecting the item Format/Page A window with three tabs appears. The first of them is used to set the page orientation (book or album), page size (for example, A4), and margin width. On the second tab, you can set the placement of text in several columns (columns). And the third tab defines the header and footer properties. But we are not yet up to such subtleties, let's finish typing the first page of text and see how the finished page will look on the screen.

Rice. 12.21. Paragraph formatting window

Just first, let’s note that, just like selecting a font, you don’t have to use the corresponding menu item to format a paragraph. First, you can use the "Format" toolbar, where you can select one of the standard paragraph styles (although at first the style selection list is not rich, but you can create your own style through the menu item Format | Style manager), the position of the lines on the page and move the paragraph to the right. In addition to the toolbar, you can use the rulers on the left and top of the text entry window to format a paragraph. These rulers allow you to set page margins and paragraph indents.

So, if you've finished typing a test, or at least typed a full page, you can see how that page will look printed. To do this, use the menu item File | Preview or the corresponding icon on the "File" toolbar. Unlike MS Word, a separate program is called to preview the page - “PS/PDF Viewer” (a few words were said about it above). If you don't like something about the page image, you can go back to formatting the page and paragraphs so that you can go back to the preview after making changes. Just to see the changes, the viewer will have to be opened again, so it is better to close the current instance.

In order not to accidentally lose the results of your work, let's save the file on disk. To save the file, you can use the menu item File | Save or File | Save as. In the latter case, you can specify a new file name and select the directory in which the new file will appear.

Since we looked at the menu File, let's see what other points it contains. In general, nothing unexpected is found here. There are points New, Open, Open Recent, Save, Save As, Create Template from Document, Statistics(at this point you can get information about the number of characters, words and sentences in the typed text), Print, Print Preview, Document Details(here you can enter some information about yourself as the author of the document), Close(current document) and Exit.

Menu Edit also does not contain anything unexpected: it contains points Cancel(previous action), Repeat(i.e., redo the canceled action), Cut, Copy, Paste, Select All(i.e. select all), Search And Replacement.

But the following menu will be unusual for MS Word users. It's called View. MS Word also has a menu item with the same name, but it contains completely different sub-items. And in KWord the following items are found:

The new kind- selecting this item opens a new KWord editor window, which displays the same document that you edited in the first window. Unlike launching a new copy of the program (a new window with the same file), when you open a new view, all changes you make to the text will be displayed in both windows.

Close all views- leads to exit from the program.

Split view- the editing window is divided into two or more panels, each of which displays the file being edited. Same as New View, but without opening a new window. In each view, you can navigate through the text independently.

Delete view- closes the current view, i.e. the panel or window in which the cursor is currently located.

Separator location- allows you to position view panels vertically or horizontally.

Next are two switch points: Page mode And Preview mode. In mode Page mode the editing panel displays one page of text, as you saw in Fig. 12.19. In mode Preview mode All pages of the document are displayed on the screen at once. Scroll bars allow you to navigate through pages. This allows you to see how figures, tables, etc. will be arranged.

Next comes the not yet activated (I worked with version 1.1 post-beta of the KWord program) item Non-printing characters, followed by three more switches: Inset frame, Page header And Footer(in the sense of "footer"). These three switches enable (or disable, respectively) the display of the corresponding page design elements (however, Inset frame is not a page design element, it is visible only on the screen).

Purpose of the last item in the menu View obvious from its name - Scale. However, instead of this item it is more convenient to use the drop-down list on the toolbar. Moreover, it is impossible to set an arbitrary scale value in either way; you can only select one of the preset values.


Rice. 12.22. Header and Footer Options

Since we're talking about headers and footers, it's worth mentioning that on the tab Headers and footers, which becomes available when you select a menu item Format | Page, you can set three parameters for the header and footer (see Fig. 12.22).

One of the headers and footers usually displays the current page number. In KWord this can be done from the following menu - Insert. You need to select an item Variable and select the item from the list that appears Page Number.

In general, through the menu Insert You can insert a picture, table, formula, special character, page break, content, variable, Expression, text frame, frame with picture, frame with object (Object Frame). It’s true that working with pictures is quite difficult. Clicking on the picture does not lead to the appearance of a menu or any symbols used to change the size. You must manage to click on the picture frame in the upper left corner, where there is a small area, clicking on which leads to the appearance of small squares in the corners of the image and the centers of the sides, by clinging to which you can change the size of the picture.

It is somewhat more successful to insert a frame with a picture. Calling up the frame management menu is also not easy - you have to go to the same small area on the border of the frame with the right mouse button to call this menu, but you can still do something. After calling the menu, the window shown in Fig. 1 appears. 12.23.


Rice. 12.23. Frame settings window (insets)

In this window, you can set the relationship between the main text and the sidebar (see Fig. 12.23) and the size of the sidebar, which for frames with pictures also determines the size of the image. However, attempts to resize pictures very often lead to the program crashing.

Inserting tables works, but the tables are not very beautiful yet. Inserting formulas is still generally something inapplicable. The "Expression" sub-item allows you to insert several fixed phrases into the text (hello, goodbye, e-mail address, etc.). The inserted variables can be the page number, the number of pages in the document, the file name, the name of the current directory, the current date and time (and, as I understand it, either the time of insertion of this parameter or the time of the last editing of the document), the data that you entered in the paragraph File | Document details, as well as any values ​​you define. Some complaints can also be made regarding the insertion of variables. In particular, after the first save of the file, the time and date insertion is preserved, and after the second save, it disappears.

On the menu Tools we see three points: Spell checking, User variables And AutoCorrect. Spell checking is a graphical shell for the built-in call to the ispell program. When an unfamiliar word is detected, it is highlighted and the window shown in Fig. is displayed. 12.24. You can replace the word with one of the suggested options or skip it (“ignore” the error). You can also directly correct the word in the line of the proposed replacement, and then click the button Replace.


Rice. 12.24. Possible reactions to misspelled words

Paragraph User Variables serves to define your own variables, and the paragraph AutoCorrect- to set rules for automatically correcting the most typical and common errors, such as two capital letters at the beginning of a word. You can change the replacement rules or set your own.

Via menu item Settings You can enable or disable individual toolbars, customize the appearance of these panels and hotkey bindings, and also make some settings for the program itself.

Well, and finally, the last main menu item, which has a traditional KDE structure: program help, information about Kword, and information about KDE. There is no help for the program yet (in version 1.1), and information about the authors is visible in Fig. 12.25. On the “Translation” tab it is reported that the translation was made by Andrey Cherepanov.


Rice. 12.25. Information about the program developers

This concludes the description of the KWord word processor. Unfortunately, it cannot yet be considered a fully functional test processor. The main complaints are the work with figures and tables. But the processor works quite normally with the Russian language and even allows you to select the character encoding. I don’t know how to do this in MS Word (if it’s even possible). So KWord is quite suitable for creating not very complex documents.

12.7.6 StarWriter and OpenOffice.org Writer word processors

The StarWriter word processor is part of Sun's StarOffice office suite. Homepage: http://www.sun.com/products/staroffice. It's free to download from the home page, but the CD-ROM costs $39.95 (in the US).

The StarOffice package was originally developed by the German company StarDivision, which was founded in the mid-1980s. In the summer of 1999, StarDivision was purchased along with its development by Sun. The beta version of StarOffice 5.1a, released on behalf of Sun, had few fundamental differences from the versions released by the original developer. Of course, the Sun logo appeared and the installation procedure was significantly (in my opinion) simplified, which became very reminiscent of the installation procedures for Windows products: answer a few questions, and then sit and read successive advertising messages. Perhaps this was a consequence of the fact that the StarOffice package was also released in a version for Windows.

In June 2000, Sun released version 5.2 of the package, with StarWriter positioned as an alternative to Microsoft Word that would satisfy the most demanding requirements. Indeed, StarWriter has a fairly large set of file filters and is quite similar to Microsoft Word in terms of a set of basic operations, so the transition from MS Word to StarWriter should be quite simple for the user. Moreover, StarWriter provides most of the features that MS Word has. With it you can create (in WYSIWYG mode) high quality documents. You can easily get text divided into several columns, insert figures and tables, sidebars into the text, set paragraph format, margin width, etc. Judging by the descriptions, there are features inherent in professional publishing systems, such as controlling the distance between adjacent letters (kerning), setting styles for individual text fragments (headings, quotes, etc.). Using StarWriter you can create envelopes, stickers, letters.

If we talk about in what cases it is worth using StarWriter as a word processor, then first of all we need to mention the fact that it is inseparable from the rest of the StarOffice package. StarOffice itself is an integrated graphical environment from which all other applications can be launched, so it is quite resource-intensive. Therefore, it is hardly advisable to use StarWriter in such cases when you need to create a small memo or a short email (unless, of course, you use the entire StarOffice package as your work environment).

Unfortunately, even version 5.2 of StarWriter is not completely Russified and does not process documents created using MS Word correctly enough, so after some experimentation with this program I gave up using it. You can read more about the StarOffice package as a whole in the book by A. Fedorchuk “Office, graphics, Web in Linux” [P1.6].

On October 13, 2000, Sun open sourced the StarOffice package. Thus, the OpenOffice.org project appeared (pay attention to prefix.org - as they say on the project’s Web page, this is how this project should be correctly named, since “OpenOffice” is a registered trademark of some other product).

The OpenOffice.org source code is based on technology that was originally developed by Sun Microsystems for future versions of the StarOffice™ suite. Unlike StarOffice, the OpenOffice.org project does not contain an integrating shell - the architecture of the package assumes separate use of the applications included in the package. The package is written in C++ and includes all the basic office applications, such as a word processor, spreadsheet, presentation management program, graphics program, charting and formula editing tools. But OpenOffice.org does not include an email, calendar, or browser client.

Other innovations include the use of a file format based on the XML standard, which makes it easier to interoperate with other products (and therefore with other computer users) and also provides a clear outlook for the future development of the product. The product includes converters for other common file formats, including formats from all versions of Microsoft Office, and improved support for Asian languages ​​(Chinese, Japanese, Korean).

The names of the individual executable files of the OpenOffice.org package trace its origins to StarOffice. The entire package is called by the "soffice" command. Individual package programs are called by the following commands:

Table 12.3. Names of programs in the OpenOffice.org package.

Currently, the OpenOffice.org package has been localized for 27 languages. The package works stably on Solaris, Linux (including PPC Linux) and Windows operating systems. Porting it to FreeBSD, IRIX and Mac OS X platforms is in progress.

This was all general information. It's time to tell you a little about your first impressions of working with the program itself. I worked with version 641b, which is part of the Red Hat Linux 7.2 Cyrillic Edition distribution from Urban Soft.

Installing the program is quite simple - expand the archive in one of the available directories and run the setup program from the resulting install directory. To begin with, you can select the standard installation option (there are also Minimal and Custom options). The installation went through without any problems, after which the OpenOffice.org641 subdirectory appeared in my home directory. This directory contains a symbolic link called soffice that allows you to run the program. This link launches the swriter program, i.e., a word processor. Other programs must be launched by their own names.

The appearance of the program window is, of course, somewhat unusual for an MS Office user. In addition to the usual menu strips and toolbars at the top of the window, there is also a vertical toolbar on the left. But, in general, all the elements of the window are quite clear.

Unfortunately, I became acquainted with this program at the last stage of working on this book, and I am not able to give a detailed description of this word processor. I will note only the most significant.

To begin with, I naturally tried to simply enter arbitrary text in Russian. There were no problems with typing, but for some reason the letters overlap each other (a problem that has already been reported in relation to StarOffice). Attempts to change the font showed that Helvetica was the most acceptable. The text became generally readable, but the effect of running letters was not completely eliminated. Inserting a picture (a snapshot of a program window) and a table went without problems (and when creating a table, its header was immediately formed).

Next, I tried to save the typed text in MS Word format. For this I chose the item File/Save as, and in the File Type drop-down list - Microsoft Word 97/2000/XP, entered the file name and clicked the Save button. Rebooted into Windows and opened the saved file. At first the picture did not appear, however, after entering the menu View I selected the item Page layout, everything fell into place. Everything is fine with the table too. So saving the file in Word format works.

The reverse action - opening a file created in MS Word in OpenOffice.org - was also successful. True, initially some lines were printed entirely in squares instead of letters. But, as it turned out, this is a consequence of the difference in font sets (or styles) - after selecting the corresponding part of the text and changing the font, the text becomes quite readable.

By the way, the following brief description of the OpenOffice.org package was typed in the swriter program.

Not having the opportunity now to engage in a detailed description of even the swriter program, not to mention the rest of the programs in the package, I just want to formulate the first conclusion. The most important thing, in my opinion, is that for the first time it became possible under Linux to work with files created in Microsoft Office. Thus, there is no longer any need to run emulators in order to view an MS Word file received as an email attachment from any Microsoft supporter. And it doesn’t matter that there are still complaints about the quality of the image displayed on the screen. All open source products are constantly being improved and developed and shortcomings will be eliminated over time. But the advent of OpenOffice.org breaks the last thread tying Linux devotees to Microsoft products and allows them to move completely to the Linux environment.

12.8. Dictionaries and translators

Personally, I have a negative attitude towards programs that are designed to automatically translate text from one language to another. No matter how hard the developers of such programs try, they cannot achieve any acceptable translation quality, and I think they will not succeed in the near future. Translations created by such programs can simply change the meaning of what is written to the point of absurdity. Therefore, I myself do not use such programs and do not recommend them to you.

Dictionaries are another matter. It seems to me that even professional translators cannot do without a dictionary. Even in our native language, we do not always understand the meaning of some words, so we are forced to use explanatory dictionaries and encyclopedias. So having an electronic dictionary is simply necessary. And such dictionaries exist, in particular for Linux. Naturally, most users first of all need English-Russian dictionaries in order to understand explanations of programs, which in the vast majority of cases are given in English.

I have not conducted a comparative analysis of electronic dictionaries, the results of which I could offer you here. The first program I came across was the slovo program, developed by D. Anisimov, to which I was already accustomed, and it suits me quite well. This program uses the well-known English-Russian Muller dictionary (although other dictionaries can be connected) and gives transcriptions of English words, so in normal practice it is quite sufficient.


Rice. 12.26. slovo program window

Receiving a transcription may cause some difficulties for you, since for this part of the program to work correctly, you need to install special fonts (this is natural, regular fonts do not contain transcription characters). However, in the manual for the program, which is also included in the Russian version, the necessary actions are described in detail, so there is no need to explain this here. At least everything worked out for me, I think that everything will be fine for you too, except that you will have to make a little effort.

After starting the program, the window shown in Fig. 12.26, only initially the three bottom fields are empty.

You can select the word that needs translation from the list in the top field, or directly enter it in the input line (second field from the top). As you type, the highlight in the word list moves to the word closest to the character combination you entered. Pressing the ‹Enter› key causes the translation to appear in the lower field of the program window and the transcription in the field located above the translation. Menu item Dictionaries allows you to change the dictionary (not all dictionaries allow you to display transcriptions; in my case, only the Muller dictionary had this property).

I hope that the explanations given are sufficient for you to be able to use this program effectively.

I came across another common English-Russian dictionary as part of the ALT Linux Junior 1.0 distribution. This is a dictionary mova Evgenia Tsymbalyuk. The graphical shell window for this dictionary is shown in Fig. 12.27.


Rice. 12.27. mova dictionary graphical shell window

In the input line (it is highlighted in yellow), enter the English word and press the "^Word" key. You can simply copy the unknown word into the input line. Instructions for using the program are given in the file Readme_mova_koi.txt attached to it, and in Russian, so No detailed explanation is required here.

Notes:

Since then, my website address has changed to http://rus-linux.net.

Currently, the site http://linux-ve.chat.ru is not supported, and all its contents have been transferred to the site http://rus-linux.net, where you will find the mentioned notes on my personal page.