I am very sensitive to text editors. After all, a text editor is one of the three most commonly used tools for working on a computer. Only the file manager and the web browser share the palm with him.

My first text editor, in which I wrote miles of assembly code, was ED*MICRON* who worked for PC "Mikrosha"- a clone of an amateur radio computer Radio-86 RK. This PC had 32Kb random access memory and a microprocessor running at a low frequency of 1.8 MHz. Despite such modest characteristics, the text editor was not line-based, but full-screen. Of course, hardware limitations dictated their own style of construction. user interface. It was minimalistic, and all consisted of keyboard shortcuts that perform certain actions. There was no hint (after all, memory had to be saved), and in order to edit the text, one had to know HOW to use the editor. Otherwise, you won't edit anything. The editor had three modes of operation - typing mode, editing mode and search mode. Isn't it so similar to a rare editor VI/VIM, which "only squeaks and spoils the text"?

At times DOS I actively used the text editor from the composition DosNavigator. Compared to ED*MICRON*, it was just a dream come true. I usually used it to process small text files. And to edit large files, I launched the console MultiEdit. What both editors had in common was a well thought out user orientation. It was very easy to learn all the features of the editor in the process of using it. All actions accessible from the menu had a hint on hot keys, and after a couple of days of work, it was possible to quickly and accurately edit texts. In addition, these editors were created at a time when the Internet did not exist. And therefore, a full-size help system was built into the editor, and most interestingly, it was up to date. The most important thing that was inherent in these two DOS editors was the predictability in work, the speed of launch and the instantaneous speed of opening a file.

Now I use for work Linux OS. And I will say this - for 2014 under linux yet not a single normal console text editor appeared. In many ways, this happened because terminal emulators (in common people - the console) under * NIX have a very specific implementation, limited by the historically established requirements for character-character devices. A couple of problems, to illustrate:

  • Functions for drawing symbols by desired coordinates very slow. And according to the Unix Way, you cannot use direct work with text-mode video memory, as was done everywhere in DOS, in the terminal.
  • There is no way to send a modifier keystroke (Alt / Ctrl / Shift) to the terminal. The modifier is passed only at the moment the main character is sent.

Therefore, and for other reasons, there is only one more or less worthy text mode library for Linux - NCurses. There are simply no other alternatives for organizing a user-oriented interface in the console under Linux. And therefore, all attempts to create a convenient text editor end up with the creation of an ugly section that does not solve the user's problems, but drives him into the framework created by the platform's limitations. Let's say more precisely - platforms created by historical limitations, which at the moment have practically no meaning, but affect the architecture of the applications being created.

I struggled for a long time, trying to get used to at least one console editor in Linux. My main requirements were the following - the predictability of the interface and the ability to work with standard keyboard shortcuts. That is, I need the text to be selected by Shift + arrows, copy by Ctrl + C, paste by Ctrl + V, cancel by Ctrl + Z, etc. That's it. However, none of the editors tested was able to satisfy such minimum requirements. I learned how to unbind Ctrl+C / V / X combinations in the console to release this combination for copy-paste actions. I exhausted myself mcedit-om, vim-om, jed, nano spent time setting up emacs, asked for advice on the LOR. As a result, I realized one thing - well, there is no normal text editor under Linux. He is not here. If you want to edit texts in Linux - either torture your brain with completely different key combinations: in the console - one, in the DE environment - others, or use GUI editors. There is no third.

Although no, the third was. I have been using the editor for several years Far under Wine! When I decided on this out of desperation, and saw that it was quite workable, I wrote the following enthusiastic post on LOR:

Ten years spent in linux were overshadowed by many things. But the darkest thing is the lack of a convenient and understandable console text editor.

I seriously started learning vi twice, went through the built-in tutorial, wrote down the learned commands on a piece of paper. But after short breaks, I completely forgot what and how to do, I remembered only the saving combination ": qEnter" to get out of this ugly. I've tried using emacs -nw, but that's even worse than vi. To call a menu in it, or just exit the program, you need to read the documentation written by absolutely insane people. Other editors, like nano and jed, are in fact the creations of people who have absolutely no idea what a user interface means.

Therefore, for lack of an alternative, I had to use the built-in Midnight Commander editor. It, of course, is far from ideal, but at least it has a menu through which you can always perform rare actions, and a crooked key prompt line.

I thought that I would never see a human console editor in linux. And recently the thought came to my mind - why not use the built-in FAR editor by running it through wine? And a miracle happened - FAR really has options to run as an editor for the specified file.

I downloaded FAR2 from the official site, unpacked it into the /opt/far2 directory, and tremblingly entered the command:

Wineconsole --backend=user /opt/far2/Far.exe /e myfile.txt 2>/dev/null

God! I cried! Everything works, just absolutely everything!! Without any dances with a tambourine! And how it should be!!!111 You can’t list everything, here’s just what I write offhand:

- Works selection Shift + Arrows.
Hello MC with his F3, and finishing off the Konsole!

- Works vertical selection Alt + Arrows.
Hello glitches MC, in which, after a vertical selection, do not raise the cursor above the selection mark.

- Full integration with the clipboard desktop environment.
Hello exchange through cooledit.clip, through which it is impossible to put and accept Cyrillic into the DE clipboard. Goodbye curve xclip!

- Ability to copy even invisible text to the clipboard.
Well, yes, you select the text (even if it goes beyond the screen), you press Ctrl + C and the text is in the buffer. This can be done not only in the editor, but also in any input field. And in any input field, you can do Ctrl + V, and not press the console combination "Paste from clipboard", especially for this case.

- Cancel the action and exit the editor - single press Esc.
Goodbye double Esc in MC. There is no need to finish up to a single press.

- Works copy-paste on the usual combinations Ctrl + C / Ctrl + V.
Goodbye F5, F6, F8 in MC, because of which, out of habit, it is impossible to work in other DE editors.

- Works intelligent Undo on the usual combination of Ctrl + Z.
Goodbye character by character Undo in MC by C-u.

- There is a well-formatted help for all keyboard shortcuts, called by F1.
Goodbye crooked reference MC, in which combinations need to be sought out in the text. Goodbye combinations of the form "M-e" and "F17".

- Works saving by F2 without the question "Really save?"
Goodbye habit of poking F2 - Enter in MC.

When you press Ctrl or Alt, the bottom line of the tooltip immediately shows what actions will be performed when you press F1-F10.
I understand, I understand, in the console it is problematic to track single keystrokes of modifiers.

- Auto-detection of file encoding works flawlessly.
I have never had to manually poke UTF-8, KOI-8 and CP1251. Just open the file and edit.

- Syntax highlighting through Colorer works great.
Goodbye curve highlighting in MC, in which when editing html-views in files with the .php extension, the presence of tags is required, and without them - porridge.

- Works fast moving to the beginning / end of the text by Ctrl + UP / Ctrl + Dn.
And in MC it has been successfully broken for a long time.

- There is no "ladder" when inserting text.
Goodbye http://www.midnight-commander.org/ticket/1603

- Line break characters are not lost.
And in MC you will never guess when the inserted text will be inserted into one line.

What is missing? Well, yes, the only thing - work in the console backend. It is not possible to use FAR in wine with "--backend=curses" option.

I registered the built-in FAR editor as an editor in MC. Of course, opening a new window with editable text does not please me. It would be desirable, that the editor was really console. Why, one wonders, was there a garden to fence, if you can call native Kate with the same success?

But to be honest - Kate is not designed to work through the keyboard. And the built-in FAR editor is intended. So I've been working with the FAR editor for two weeks now and I'm not overjoyed. At first, the new window was annoying, and a little slow start (about 1 second against the instant launch of the built-in MC editor), but now I'm used to it, and the benefit from the convenience of editing is obvious. I finally started editing text comfortably and quickly. What do you want.

Hi to all the redheads.

Why did I decide to give up FarEdit under Wine? Principle, me in FarEdit everything suits me. Absolutely everything. The only thing that doesn't suit me is the quality of the emulation of Wine itself. In fact, it turned out that the Wine console does not keep up with my speed of work, and from time to time it segfaults. Typically, these segments occur when actively working with modifier keys. Segfolts are rare, but they do exist. And it starts to tire, especially when you shovel large amounts of text. It's unpleasant, you know, ten minutes to edit a file, and instead of saving the results of the work, you get a segfault.

Therefore, since the dream of a console editor in Linux is not destined to come true, and even FarEdit creates a separate window for the console backend, then you need to find a convenient GUI editor tailored to work with the keyboard.

The code editors listed here will help developers transitioning to Linux develop revolutionary new applications.

Learning to code can be difficult, but the right tools make the process a little easier. Once you start writing great code, you can get so carried away that you forget about everything else. But this exhilarating experience can be spoiled by the wrong toolkit. If we talk about cars, MacBook, perhaps, the best choice for developers who spend hours weaving code. Apart from the Mac OS that runs on the MacBook, there is another platform suitable for building applications, and that is Linux.

Over the years, Linux has evolved and expanded, gaining market share from Windows. Thanks to the efforts of the community, today there are many Linux distributions for a wide variety of needs.

There are even distributions made for developers. However, you don't have to switch to them to use the code editors in this article.

These programs will increase your productivity with their thoughtful features.

1. Atom

Atom is an open source editor developed by GitHub. It will suit any developer, from noob to expert. The biggest advantage of Atom lies in its customizability for any needs and at the same time the ability to start working immediately without looking into the configs.

Atom offers several customization options to change the look and feel to your liking. If you're familiar with HTML and JS, you can even tweak the look and feel by making some changes to the UI. All these properties make Atom the leader of our list.

Atom Code Editor Features

  • Cross-platform editing: Atom is available not only on Linux, but also on other platforms such as Windows and Mac.
  • The built-in package manager allows you to easily search for and install new packages.
  • Smart Completion: With this smart, flexible Atom feature, you can code faster.
  • Browser file system allows you to easily search and open individual files, an entire project or several projects in one window.
  • Multiple panels: You can compare and edit code in different files by splitting the interface into several separate panels.
  • Power and Simplicity
  • Wealth of settings

Against:

  • Beginners will have to work with this editor for some time to learn how to use its functionality to the fullest.

Installing Atom on Linux

If you are using Ubuntu or its derivatives, you can install Atom using the PPA by running the following commands:

  • sudo add-apt-repository ppa:webupd8team/atom
  • sudo apt-get update
  • sudo apt-get install atom

If you are using Debian or Fedora-based Linux distributions, you can use the .deb and .rpm packages. Atom is currently only available for 64-bit systems.

2. Sublime Text 3

Sublime Text is the most widely used code editor for Linux in the developer community. It is a lightweight and uncomplicated code editor. Sublime Text is built from custom components for unrivaled responsiveness. With a powerful, customizable, cross-platform UI toolkit with an unrivaled syntax highlighting engine, Sublime Text sets the bar high for productivity.

This program can be used as a simple text editor with syntax highlighting. By connecting additional plugins, you can expand its functionality so that it is capable of almost everything that an IDE is capable of. In addition, Sublime Text offers many customization options. Keyboard shortcuts, menus, snippets, macros, extensions, and more - almost everything in Sublime Text is configured using regular JSON files. This system gives you flexibility as the settings can be different for different types files or different projects.

Features of Sublime Text 3

Here are some of the best features of this editor:

  • Multiple Selections: This feature will increase your productivity by allowing you to make multiple changes at the same time.
  • Command Palette: You can perform various operations with just a few keystrokes, saving time.
  • An abundance of settings will help you customize the appearance and behavior of the editor.
  • "Non-distraction" (Distraction Free) mode: your files are displayed in full screen, and side panel, menu, map are hidden.
  • Support for many programming and scripting languages.
  • Simple interface.
  • Code completion and syntax highlighting.
  • Performance.
  • Extensible Python API.

Against:

  • Complex integration of functionality.

Installing Sublime Text on Linux

The stable version of Sublime Text 3 can be installed by typing the following commands in a terminal. This method is suitable for distributions based on Ubuntu and Debian. If you are using other distributions such as Fedora, Arch and Suse, please refer to this page for installation instructions.

  • wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt key add-
  • echo "deb https://download.sublimetext.com/apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
  • sudo apt update
  • sudo apt install sublime text

3. Vim

Vim is an improved version of vi, the editor program that comes with most UNIX systems. Vim is often and rightly referred to as a "programmer's" editor. It's highly reconfigurable and very useful in programming, which is why many consider it an entire IDE. Of course, it is suitable not only for programmers. Vim is great for any kind of code editing, from composing emails to editing configuration files.

Vim can be used as a standalone application or run on the command line (it's one of the first programs that comes to mind as an editor). command line).

Features of Vim

  • Automatic commands
  • Entering digraphs
  • Screen split
  • Session Screen
  • Tab expansion
  • Color syntax
  • Tag system
  • Powerful and complete feature set for programmers.
  • stable and popular.

Against:

  • For beginners, the program is difficult, but if you're willing to spend some time learning, you'll be fine.

Installing VIM on Linux

There are several ways to install Vim on Linux. There are various installation files, but here we will show installation via a PPA repository.

  • sudo add-apt-repository ppa:jonathonf/vim
  • sudo apt update
  • sudo apt install vim

By the way, to make it easier to learn the editor, you can run vimtutor - a manual and a program for practicing work skills.

4. Brackets

Brackets is a modern, popular code editor from Adobe available on Linux. It's free unlike the other software Adobe. If you are a web developer, then Brackets is especially suitable for you as it is built with development in mind. This editor has several features that can be extended with additional plugins. Adobe has been working on Brackets to create the best modern code editor for Linux.

Brackets after installation already has all the features required for a modern text editor. It is based on JavaScript.

Brackets text editor features

  • Live view: You can immediately see the result of code changes.
  • Inline editing allows you to edit CSS or snippets of other code at once, without going to the appropriate file.
  • Preprocessor: Editing preprocessors with Brackets is more convenient than with other similar text editors. You can easily edit SASS and LESS files.
  • Lightness.
  • Open source.
  • Powerful visual tools.
  • Availability of useful extensions.

Against:

  • Not the best more advanced scripts and languages.

Download and install Brackets

The latest version of Brackets is v1.11. You can install it on your Linux machine by downloading the .deb package. This the way is fine for Ubuntu and Debian based distributions. For other distributions, you will need to compile the source code available on GitHub. The commands below are for installing Brackets from the appropriate PPA.

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

5. Bluefish Editor

Bluefish is more than a code editor. It seems more like a modern IDE like Eclipse and Netbeans. With his big set functions, it can do almost everything the same as the IDE. One interesting feature of Bluefish is its integration with third party programs. Bluefish is universal in terms of support for various languages. It supports Ada, ASP.NET, VBS, C/C++, CSS, CFML, Clojure, D, gettextPO, Google Go, HTML, XHTML, HTML5, Java, JSP, JavaScript, jQuery, and Lua.

Bluefish Features

Here are some features that make this code editor stand out from the crowd:

  • Speed: Bluefish starts up fast (even on netbooks) and downloads hundreds of files in seconds.
  • Integrating external filters of your choice, redirecting your document (or selected text) to the input of sort, sed, awk commands, or any custom script.
  • Multithreaded support for remote files using gvfs, support for FTP, SFTP, HTTP, HTTPS, WebDAV, CIFS.
  • Built-in spell checker that recognizes programming languages.
  • Support for many programming languages ​​and scripts.
  • Clean and user friendly UI.

Against:

  • Lack of ability to edit many lines at the same time.

Installing Bluefish

To install Bluefish on Ubuntu or distributions based on this OS, you can run the following commands:

  • sudo add-apt-repository ppa:klaus-vormweg/bluefish
  • sudo apt-get update
  • sudo apt-get install bluefish

Conclusion

Developers often disagree on the best code editor in general and specifically for Linux. The editors featured in this article have been selected based on their performance, usability, and customization options. You can choose the one that suits you best, both from this list and from those not included in it.



Chapter 12

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, is simply a sequence of bytes. Text characters are encoded different values byte or sequences of bytes. Information about exactly how these characters should be located on the page is also encoded using non-displayed control characters, such as the end of a line or the tab character. In the simplest cases, the number of control codes is limited to the first 32 byte values ​​(or ASCII code), and all other byte values ​​are used to encode information characters. These are the files we call ASCII files. Examples of such files are files created by editors such as Midnight Commander's built-in editor, files generated by the program notepad on Windows and vi on UNIX.

Over time, there was a desire to expand the possibilities of text formatting, which means that it was necessary to increase the number of codes used as control codes, and even byte sequences (ASCII characters) 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 are files that use their own format for representing text (in which text characters are also represented by special sequences). The essential difference between the formats of the third type 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 with Notepad, but it is not possible to do the same with MS Word 97 files.

Sometimes it is difficult to attribute a file to one type or another at first glance. For example, Post Script files are technically Type 2 because all readable text is in ASCII, but there are so many formatters in these files that the text can be found only with great difficulty, much like 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, the user uses a familiar text editor to view files. 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, one has to either find a text editor that understands Word formats, or find translators from Word format to one of the open standard formats. However, even if the information is presented in "plain" ASCII code, when viewing a file, you may encounter "unreadable" text due to the difference in the Russian language encodings used. So first let's look at how to read (or view) files various formats or in different encodings.

12.2. Programs for viewing texts in different formats

Somewhere I read that it was in the tradition of UNIX to create a separate command for each elementary action. This observation is well illustrated by the presence in Linux of a whole collection 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, just working in the terminal.

12.2.1 Traditional UNIX tools for viewing text files

The simplest file viewer is probably the cat command. After displaying the contents of the current directory with the ls command, you can also display the contents of any existing file with the cat command. True, there is one inconvenience: if the file is large, then only its last lines remain on the screen, everything else "runs up". Of course, you can 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 pagination, there is a more filter command. It can be used in two equivalent ways:

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

To view only the last few lines of a text file, there is a special tail command, which can be used as a parameter to specify the number of output lines. It can be assumed that the presence of such a command was very useful in the 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 had stopped.

However, those days are long gone. To create texts began to use text editors, and for saving - not simple ASCII files, but special, rather 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 the slang of computer scientists - viewers), which do not display all the special formatting characters on the screen, but convert them to the appropriate 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 Portable Document Format (pdf) files, which is widely used in computer world and is used on different operating systems and on different platforms. PostScript documents are easily converted to this format. PDF files are very common on the web. 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. This is precisely what the Adobe Systems Incorporated Acrobat Reader program serves for, which is distributed free of charge both in the version for Windows and in versions for UNIX, and in particular for Linux. Currently, version 4.05 of this program for Linux can be obtained free of charge from the company's website http://www.adobe.com (version 5.0 has already been released for Windows).

To install Acrobat Reader 4.05, you 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 uninstall it first.

Before starting the installation, select one of the two possible installation options: network or local (on a separate computer).

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

A network installation facilitates administration and maintenance of the program, especially in cases where the program is used by many users. Obviously, it is easier to update one instance of the program on the server than to update many copies on individual computers. The network installation must be performed by the server administrator.

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

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

If you obtained the Acrobat Reader file from the Web site, you must first unzip the installation files using the gunzip and tar programs. After that, you need to change to the directory containing the installation script and run it:

The installation script prompts you with several questions, such as 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 installer. If you made a mistake somewhere, you can interrupt the installation with the ‹Ctrl›+‹C› combination and start all over again.

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

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

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 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, at the end of 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 start the Acrobat Reader program. To do this, 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 make it convenient to run the program in a graphical environment, it remains only to create an icon ("icon") on the desktop (if you do not remember how to do this, see the description of the graphical environment you use) and the installation process of the program can be considered completed .

Now you can launch Acrobat Reader (of course, graphics mode must be running for this) 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 with 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 a hint on how to use the program, enter one of the commands

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

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

With the help of similar commands (a more detailed description of which you can find in the documentation for the program), 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 features of the Acrobat Reader program, since it is widely used and familiar to many readers. Let's take a closer look at specific Linux file viewers.

12.2.3 gv program

gv (or ghostview) was developed by Johannes Plass and is designed to view PostScript and PDF files (Figure 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 button 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 desired file. After that, 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. Only to use this menu, you must not just click on the buttons, but hold left button mouse pressed.

With 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, to access a separate program settings window, shown in fig. 12.2.


Rice. 12.2. gv program window

Button Page is used to move to the next or previous page of the document. The same transitions can be made using the two small buttons marked with 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, that is, upside down), 270 degrees (Seascape).


Rice. 12.3. File selection window for viewing in gv

Rice. 12.4. gv 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 tool for previewing what will turn out 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 various 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 someone who has worked only with Windows. Meanwhile, the KDE integrated graphics environment includes two programs with a more traditional look. These are "PS/PDF Viewer" and "DVI Viewer" (as these programs are named in their own window titles and in the KDE menu). Their interface is very similar and this is explained by the fact that they work through one shell - KviewShell. However, in the KDE menu they appear as separate programs, and each of them displays its own name in the title bar.

Comment:

Here it can be noted in passing that in UNIX the following technique is very often used: a "workhorse" (back-end) is created, to which beautiful shells (front-end) are then written for different cases, for example, for text and graphic 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 single out these points separately.

On fig. Figure 12.5 shows the window of the PS/PDF Viewer (by Wilco Greven, David Sweet, Mark Donohoe, David Faure, Daniel Duley, and Espen Sand.), otherwise known as Kghostview, which seems to indicate its origins in program discussed in the previous subsection. The relationship with the previous program is also evidenced by the fact that almost all menu items repeat similar gv items, only the menu is organized a little differently. This can also be seen from the figure. It does not make sense to talk in more detail about the program, it is enough that you know about its existence. And you can easily learn how to use it yourself.


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

I will not talk about the DVI Viewer program either, limiting myself to the already mentioned mention of it and the message that it is designed to view DVI files created by the TEX layout system.

12.2.5 WordViewer package

As mentioned above, one of the biggest problems for Linux users- this is working with files in MS Word formats (and other programs from the MS Office package). After all, so far most of the texts are created in this format. The most common viewer for such files is the program (more precisely, the program library) wv, which used to be more fully called mswordview.

The wv library is intended for accessing MS Word 2000, 97, 95 and 6 format files from UNIX type operating systems, in particular from Linux. The ALT Linux Junior 1.0 distribution includes version 0.6.5 of this package by Dom Lachowicz and Caolan McNamara (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 MS Word files, let's convert the text from these files into some open format. You can select one of the following formats as the latter: HTML, PS, PDF, LaTex, DVI (TEX publishing system format), ABW (AbiWord text editor format), Wml (format used in PDA personal organizers and Web phone devices) , ASCII text. Calling individual library procedures can be used in other applications. The developers promise that the reverse transformation will soon become possible: from the listed open formats- in MS Word format.

The package consists of separate programs, each of which is designed to convert a doc file to 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 in MS Word itself can be entered through the menu item File | Properties. This is what the output of these commands looks like (for the file I used in this example, service data was not entered; however, if you enter them in Russian, then there will be not much more joy, since we will receive the output in the CP-1251 code page, so the text on 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 to use.

Sets the code page for iconv.

Sets the password for encrypted Word documents.

Specifies the directory where the generated graphics will be saved.

Returns the wvWare package version.

Displays a brief summary of how to use the program.

The output filter, specified with the -x or -config= option, specifies the output file format. If this option is not set, then the output filter is searched in the current directory or (if not found in the current one) at the package installation location. 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 can be viewed using any Web browser. Of course, in this case, some of the formatting options available in Word are lost, and this must be borne in mind when viewing the resulting files.

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

12.2.6 Code page converters

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 come across a file whose contents are "unreadable", then you will need a transcoding program. As the RU.LINUX.FAQ says: "The number of CP1251 and CP866 -› KOI8-R recoders is huge. No need to write new ones ;-). Iconv (included with glibc) and GNU recode are the most widely used."

The iconv program is run like this:

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

If you do not specify an output file (option -o), then 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 (which is huge!), type iconv -list, or for help: iconv -? or iconv -usage. By the way, no man page is given. However, there are still very few other options: only -verbose (report additional information), -V, and -version (both options serve to display the version of the program).

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

It starts like this:

$ recode CP1251..KOI8-R winfile.txt

In addition to the above commands, you can use the "Russian Anywhere" program, which exists both in the Windows version (where I met it) and in the command version. linux strings(the creators promise to release a graphical shell). This program can be downloaded (both in source codes 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 not known and re should parse the file and determine its encoding itself;

K - sets 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 a letter.txt file that was created in Windows, and you know that the file is saved in 1251 encoding, then you need to issue the command:

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

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

The full format of the transcoder call is:

$ re options filename_from filename_to cp_from cp_to

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

V - give information about the progress of processing;

N - do not display 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 denoting 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 did not have any of the indicated transcoding programs, then to view the contents of the file, you can use one of the Internet browsers, which are initially focused on working 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, then change the encoding through the menu View/Character Set.

12.3. Spell check

Before moving on to a discussion of text editors under Linux, it is necessary to briefly review 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 include 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 for its Russification - the ispell-russian-3.1.20-23.i386.rpm package. Both packages were part of the Black Cat Linux 6.02 distribution. To install the first package, just issue the command

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

and for the second - the command

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

After that, 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 are not going to check spelling in these languages.

To check the text, it is now enough to issue a command of the following form:

$ ispell -drussian edit.htm

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


Rice. 12.6. Spell checking with ispell

The principle of the ispell program is very simple: every word in the file must be in the program's dictionary. If the 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 topmost line displays the detected erroneous word and the name of the file being checked. Below are several lines (a number can be specified) from this file containing the detected error. If the dictionary contains words similar to the erroneous ones, they are displayed below (with ordinal numbers). This is followed by a prompt line and the command line of the program.

You can use the following keyboard commands in the command line at the bottom.

Table 12.2. Substitution commands in the ispell program.

Team Action to take
‹R› Replace the wrong word (the program will prompt you to type the correct word on the bottom line of the screen)
Skip this occurrence of a word
‹A› Skip all occurrences of the 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, only the word is written in lower case (in small letters)
‹Q› Immediate exit from the program (confirmation is first requested, and the file being checked remains unchanged; changes made are not carried out)
‹X› Cancel the scan, save the changes and exit the program
‹!› Temporary exit to shell

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

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

If you think about the principle of checking that is built into the program, it is easy to understand that it can only check a very limited class of errors, namely, spelling mistakes consisting of misspelled words. Obviously, no errors in grammatical constructions, word agreement, etc. will be detected.

Another drawback of the program, which I encountered, manifests itself in cases where there is not enough free space on the current disk, less than is necessary to write the corrected file. The program in this case writes only that part of the file that fits, and loses everything else. No warnings are issued for this.

If there is no shortage of disk space, then after making corrections, the program writes the corrected version of the file, and original file saves 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 (www.linuxlinks.com lists about 100 titles, and that's probably not all). So there are plenty to choose from. And it's worth spending some time on optimal editor selection.

Of course, in order for such a choice to be justified, ideally one should try all or most of the editors. This is obviously impossible, so one has to rely either on chance or on the opinion of one of the acquaintances or authors of computer books. (By the way, a good, in my opinion, review of text editors is contained in A. Fedorchuk's book "Office, graphics, Web in Linux" [A1.6]. I will also try to express my impressions about 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 automatism, gets used in a certain way, through menu items or mouse clicks, to perform standard editing operations and, in general, adapts to the editor environment. Therefore, there must be good enough reasons for changing the editor.

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

One is a powerful WYSIWYG word processor that provides rich text formatting options and a lot of additional features, which are not available in simpler editors. I would include text editors (processors) from the StarOffice, Applixware, KOffice packages, individual Maxwell and WordPerfect 8 word processors, AbiWord, and the TEX publishing system to this type. All editors of this type I will call word processors. True, some authors, for example, the same A. Fedorchuk, nevertheless divide them into simply editors and processors, but I see no reason for this. Strictly speaking, the whole question is in the text formatting options that the editor provides. And any precise criterion for dividing the editors of this class into two subclasses is difficult, if not impossible, to offer.

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

And yet you need to be able to use one of the console text editors, because you, as the only user (and even superuser) personal computer, should be able to edit configuration files, and in any situation, even when the graphical mode is not loaded. 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. Longtime UNIX devotees most often use vi or its enhanced version of vim, but for those who are migrating to Linux from the environment Windows is easier will master CoolEdit, which is very similar to the built-in editors of 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 selected types of editors. The first version of the section describing each editor considered below was created in the same editor that is described in this section (these first options were posted by me on the site 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, the selection criteria may be different for everyone. 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 messages of the program should also be Russified (although to some extent you can put up with English terms here, especially if there are good description programs in Russian, because the number of menu items is usually small and their meaning can be simply remembered).

12.5. Console editors for ASCII files

Let's start by looking at text-mode editors, that is, those that work in the console. Speaking of such editors, it is simply impossible not to mention the editors vi and emacs, but the built-in shell editor Midnight Commander will be considered more thoroughly - cooledit.

12.5.1 vi type editors

The vi editor (or its slightly modified descendants) is included by default on any UNIX-like system, including all Linux distributions. All adherents of UNIX who have considerable experience with these operating systems know and use this editor. Description of the editor vi you can find if not in any, then certainly in most books on UNIX. Editor vi there are several descendants who in some way improve and improve it. These are the editors vim, bvi, Nvi, Elvis, Levee, vile, Wily(editor vim even called in Linux by command vi). A brief overview of the editors of this class can be found in A. Fomichev's article "Text editors for UNIX OS" ( open systems, N 4, 1994). However, for those users who have migrated to Linux from a Windows environment, all these editors are unlikely to be convenient. The reason is that these editors do not have the usual menus and tooltips (as far as you can tell from vim version 5.3) and you have 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 input and command input, and a beginner often simply confuses the modes. In general, without a printed manual, I would not recommend you to take on the development of editors of this type. And although those who have mastered vi often resort to its help for editing simple files(especially configuration files and scripts), I think that there are more convenient means, and therefore I do not consider editors like vi(although I couldn't help but mention them).

12.5.2 The Emacs Editor

The most famous among the editors used in Linux is emacs. It exists in both text mode and GUI 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 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 virtual store "Bolero". An excellent introductory description of this editor can be found in A. Fedorchuk's book "Office, Graphics, Web in Linux". However, I believe that it is advisable for novice users to edit ASCII files using CoolEdit- built-in editor file manager Midnight Commander.

12.5.3 CoolEdit - built-in editor of Midnight Commander

CoolEdit is an easy-to-use program with keyboard shortcuts familiar to most users (especially those who have worked with Norton Commander under DOS or FAR under WINDOWS). In addition, it should be borne in mind that usually any work with a file begins with a file manager, since at first you need to at least 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 small, but convenient. Given 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 the editing mode and open the menu item File | About authors.


Rice. 12.7. Appearance of the Cooledit editor window

This editor provides most of the editing features 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. Provides editing of executable (binary) files without data loss.

The following features are supported:

Copying, moving, deleting, cutting and pasting blocks of text;

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

Dropdown menus;

Inserting files;

macro definitions;

Search and replace with 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 with the key combination ‹Shift›+‹arrows› in the style of MS Windows - MAC (only for linux-console);

Switching between insert-replace modes of a character.

The editor is very simple and practically does not require training (especially since you can find versions in which most of the menu items are Russified, such a version was included, for example, in the Black Cat 5.2 distribution kit). In order to find out which keys cause certain actions to be performed, it is enough to view the drop-down menus called by pressing the ‹F9› key in the editor window (Fig. 12.8).


Rice. 12.8. Exit to the Cooledit menu by pressing ‹F9›

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

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

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

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

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

If you have installed the program gpm- mouse driver for the console, 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 select 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› and then enter the command lines to be executed. When you have finished entering commands, press ‹Ctrl›+‹R› again and associate the macro with some 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 cedit/cooledit.macros file in your home directory. You can remove a macro by deleting the corresponding line in this file.

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

To give an example, suppose you want to replace all occurrences of blocks of text consisting of an opening bracket, three numbers separated by commas, and a closing bracket with a block consisting of the word apples, the third number in the original block, the word oranges, and then the second number in the original block. Then, in the dialog box that appears when calling the replace command (‹F4›), you must specify 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 for the first and second arguments. It is still recommended to use the "prompt on replace" option when performing a replacement, because the program considers all cases where the number of arguments matches the specified number to be matches, although this does not always mean a complete match. Scanf also doesn't care about 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's better to set the option Character bits(Display bits) from the menu Settings to the "7 bit" position to save the file format.

It would take too much space to describe all the features 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 the menu items, which is called by pressing the ‹F9› key in the editing window. You can also read the man page with man mcedit or info mcedit.

At the end of this brief reference according to 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:

We mark the beginning of the block with the key ‹F3›;

Move the cursor to the end of the block;

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

We type the combination ‹Ctrl›+‹Insert›;

Close this file, open another;

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

Everything, the task is completed. Transferring a piece of text in this way can be done from one virtual console to another.

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

I did not immediately find a way to solve it (i.e. wrapping a piece of text) that works both in the console and in the graphical shell window. This method consists in transferring a piece of text through another file (the file ~/.cedit/cooledit.clip is used by default). Highlight a piece of text, select a menu item File | Copy to file(File | Copy to file) and press ‹Enter›. Then go to another file, put 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 would not have to memorize other key combinations, change the familiar environment. The CoolEdit editor described in the previous subsection can be launched via 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, the work with the mouse in editors that are initially focused on graphics mode is organized much better than in console editors, which increases the overall usability (although this may be just my subjective feeling). Therefore, I still recommend not to limit yourself to using only a console editor for ASCII files, but to master one of the many editors focused on processing such files in graphical mode. Consider three such editors.

12.6.1 KEdit editor

The KEdit and KWrite editors are part of the KDE graphical environment. They are designed to work 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've ever edited text at all, you won't have any problems with it. In addition, if KDE is already Russified for you, then there will be no problems with entering and displaying Cyrillic characters. Moreover, the menu and messages of the program are also Russified.

You can open a file for editing through the menu or by pressing ‹Ctrl›+‹O›. This will bring up a window where you can select a file to edit. Everything is familiar here, and I think that you do not need additional explanations. In addition to this method, when working in the KDE environment, you can also use the "Drag and Drop". This means that from the Konqueror file manager you can grab a file with the mouse and simply "drop" it into the KEdit window.

Basic editing operations are performed using the keyboard. The ‹Insert › key switches between insertion and character replacement modes. Moving through the text is carried out using the arrow keys and the keys ‹Page Down›, ‹Page Up›, ‹Home› (go to the beginning of the line), ‹End› (go to the end of the line). You can select a block of text (unfortunately, only linear) with the mouse or with 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. The KEdit editor window.

In many editors, including KEdit, moving through text and deleting can also be performed using keyboard shortcuts (maybe due to the fact that old 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 character to the right of the cursor.

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

The 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 the fingers find these combinations automatically:

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

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

‹Ctrl›+‹V› - paste a fragment 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 text fragment 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 broken into lines whose length does not exceed the value specified in the corresponding option of the Settings menu item.

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

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

KEdit supports printing. You can print both the entire edited file and the selected text fragment. Printing is done on the default printer. Additionally, you can connect any of the printing utilities that are developed for UNIX in many ways.

What really impressed me when I first started using KEdit was the built-in spell checker and the ability to view and edit both CP-1251 and koi8-r encoded files.

To change the encoding, you need to play with the choice of fonts in the menu item Settings | Font. Unfortunately, not all fonts support both encodings, but after several attempts, I manage to select the desired font. To check spelling, just select the menu item Editing | Spell check. Naturally, the ispell program must be installed in the system, and, in addition, before starting the test, it is worth entering the menu item Settings | Spell check and select a Russian dictionary and the desired character encoding (see Figure 12.10).

By the way, the menu item Settings in general, it is advisable to take a closer look before starting editing some files, select the settings you need, and then save them (subparagraph 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 mail program straight from the editor. I have not been able to test this function because home computer(isolated) I have nowhere to send letters. But I often use this function at work, in MS Word, and it seems to me very useful and convenient.

In general, this editor made the most favorable impression on me from the first meeting, so I recommend that you get to know him better. You might even choose to edit ASCII files while working in graphics 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 service words. Coloring is set by sub-items Set coloring and Coloring… item Settings. Since I often edit the HTML file, this feature seemed convenient to me.

There is one new item in the main menu - Bookmarks with subparagraphs Set Bookmark(‹Alt›+‹S›), Add bookmark and Clear bookmarks(‹Alt›+‹C›). The rest of the main menu items are the same as for KEdit.

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

Perhaps this is all that has appeared new in KWrite compared to KEdit. But, unfortunately, some useful features are missing. In step File the item concerning sending the file by e-mail. In step Edit there is no way to insert a date. The ability to select a font in the paragraph has also disappeared. Setting | Configuring KWrite which I consider to be the biggest disadvantage 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 the KEdit editor will be available in KWrite, and it will become the "regular" text editor of the KDE shell.

12.6.3 Nedit text editor version 5.1.1

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


Rice. 12.11. Appearance of the Nedit editor window

After the first acquaintance with this editor, I decided to abandon the use of 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 time".

Perhaps the only (in my opinion, not very significant) drawback of Nedit compared to KEdit or KWrite can be considered only that menus, messages and tips are displayed on English language. True, there is no such item in the menu as sending a mail message, but it is possible to execute any shell command or create a macro, which more than covers the lack of a direct call to the mail program.


Rice. 12.12. Font window in Nedit

Switching the editor to enter Russian text was not difficult for me. To do this, enter the menu item Preferences/Text Fonts… and set the desired fonts in the input lines of the corresponding window (see Fig. 12.12). And, since it is rather difficult to remember these long strings with font names, you can use the Browse ... button and select a font from the list displayed (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 such a font is not available.


Rice. 12.13. Choosing fonts in Nedit

Considering that, due to a fairly long period of use of editors such as editors file managers FAR for MS Windows and Midnight Commander, I have developed habits of using certain key combinations, I was very pleased to find that the usual combinations ‹Ctrl ›+‹X›, ‹Ctrl› are used to cut, copy and paste blocks of text in Nedit +‹C› and ‹Ctrl›+‹V›. Selecting 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 down ‹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 handy if you don't remember the key combination to perform the intended operation. And old habits do not always help, in particular, to undo the last operation in Nedit, not ‹Ctrl›+‹U›, but ‹Ctrl›+‹Z› is used.

On the same menu Edit there are two sub-items lower-case and upper-case), with which you can translate the text in the selected block, respectively, to the bottom and upper case.

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

Paragraph Search the main menu contains calls to search and replace operations, as well as a quick transition to the desired line or to a previously made bookmark (and setting such a bookmark-mark).

To customize the program according to your tastes and habits, use the menu item Preferences. I have already told you how to choose a font for displaying text in the program window. Here you can use the command language mode select the language (for example, html or C), according to the rules of which text elements (functional 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, save mode backup file, insert/replace character mode.

Paragraph Shell used to run shell commands and external programs. Here, in particular, you will find 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 invocation ispell, add the -d russian parameter and the check of Russian-language texts will work (in a separate terminal window).

Through the same ~/.nedit file, you can set 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 A. Fedorchuk's book.

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

In this brief description, I did not touch the menu item Macro, as well as those sub-items of the main menu that are focused on actions performed when editing program source texts (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 learn more about him, read A. Fedorchuk's articles on the Internet or his book [A1.6].

12.7. Word processors

Let's agree that the term "word processors" will refer to 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. These inserts are not displayed by the word processor as any characters during editing. In this sense, Nedit is not a word processor, but Netscape Composer is, because it shows the formatting elements in a graphical way, not in the form of html tags.

12.7.1 Features of word processors

To standard means text formatting include:

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

Setting the width of the fields, the size of the indents, intervals;

Organization of text in the form of columns;

Inserting figures, tables into the text;

Ability to create inscriptions at an angle to the line or curved shape;

Spell check (for user's 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, I mean MS Word in the first place!). 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 usability, this is already a minus.

With this informal definition in mind, consider a few software products for Linux, claiming the high title of a word processor.

Since, in their main purpose, text editors are closely related to the 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 the possibility of Russification. In order not to repeat the same thing when describing each of the products discussed below, I note right away that not only the standard Type1 fonts supplied with the Black Cat 6.02 distribution kit were installed on my system, but also True Type fonts from Windows (see Chapter 11 ).

12.7.2 Linux word processors

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

A special place among word processors is occupied by the TEX publishing system and products based on it, such as Lyx. As for TEX, it is more of a programming language than a text editor. If you're programming in two or three different languages, you might not find it difficult to master TEX as well. 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 the X Window on Unix/Linux systems and plays roughly the same role as WordPad on MS-Windows, only with more features. The main advantage of Ted over the editors discussed in previous sections is the ability not only to enter and edit text, but also to provide basic text formatting, change fonts, and insert tables and figures into text. It is because of the presence of these features that I ranked this editor as a word processor, although it does not have all the features of advanced word processors.

The package distribution can be downloaded from the site 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 tar archive or as an RPM package. The Russified version of the editor can be found on the ftp://ftp.logic.ru/ server (of course, Russification by version is slightly behind).

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

After launching it, a window appears in which an engraving in the style of Albrecht Dürer 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, respectively, select the sub-item New menu file or type ‹Ctrl›+‹N›. After opening the file, the program window takes the form shown in Fig. 12.14.

Ted supports the .rtf (Rich Text Format) file format to provide 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(i.e. the ability to open any rtf file in Ted) is not achieved because some of the formatting options used in rtf files are not accepted 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. The main window of the Ted editor

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

Editing files in WYSIWIG mode. You can use all fonts for which you have .afm files and are available for X11. Ted comes with .afm files for Adobe fonts that 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 normal procedures used for this in X11. Font properties such as bold, italic, underline, superscripts and subscripts are supported.

Insert pictures in bitmap format.

Printing on PostScript printers.

Working with Acrobat PDF files.

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.

Paragraph formatting: indentation on the first line, offset of the entire paragraph, use of rulers.

Pagination of text.

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

Supports inserting characters from different code tables.

Saving a document in text and HTML format.

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


Rice. 12.15. Spell checker in Ted editor

I learned that Ted can be fully Russified from Victor Wagner's article [P14.19]. The most interesting feature of the Russified version is the presence of a spell check for the Russian 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.

True, 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 the Latin script are indicated as errors (although even ispell has no problem ignoring them). Secondly, words that begin with a capital letter are perceived as errors (the program suggests typing such a word in full capital letters). And, what is most incomprehensible, a lot of correctly typed words are perceived as erroneous, and exactly the 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 to enter and display Russian letters. In order for Ted to correctly display koi8-r encoded fonts on the screen, you need to create a file xfonts.dir in the /usr/local/afm directory, where Ted keeps font metrics (*.afm), by 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 that, Russian letters are entered and displayed normally. However, the problem is not yet completely solved: after you work with format tool or any dialog containing an input string, Ted stops typing Russian letters again. The solution to this problem suggested by Ivan Pascal is to create an empty file /usr/X11R6/lib/X11/locale/koi8-r/Compose and add to /usr/X11R6/lib/X11/locale/compose.dir line:

This solution worked fine for me (except that the ‹Delete› key stopped deleting characters and started inserting spaces, so you have to use the ‹BackSpace› key to correct errors).

Now consider the issue of adding new fonts. Only 4 fonts come with the standard Ted distribution: Courier, Helvetica, Symbol, and Times. If you want to design your documents in a more diverse way, you need to add other fonts. You can use any font in Ted that you see in your GUI, but there are a few things you need to do. To find out what fonts you have, run the xfontsel program and select the font you want to add. Let's assume it's a Bookman Light.

In order for Ted to see a new font, you need to put the metric of this font (the metric is an .afm file) 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 W. Wagner writes, Ted refused to load fonts from kapella for a long time, since the afm file does not contain references to several characters that appear in Adobe Standard Encoding. At the same time, working with font metrics is a mandatory feature of a more or less advanced formatter, since the information about the font that the X server provides is not enough for quality printing. If you try to work with Ted using metrics that don't match your fonts, the result will be ugly - the 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 that, when launched with the Russian locale, Ted will display all menus and most of the messages in dialog boxes in Russian.

12.7.4 AbiWord word processor

AbiWord is a small, fast, free and easy to learn and use word processor for X. This 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, and it works directly in the text input process.

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

In native AbiWord format (.abw);

In text format (.txt);

RTF format (.rtf);

In HTML format;

In UTF8 format;

In LaTeX format.

Thus, in principle, through the RTF format, you can organize the exchange of files with users of MS Word.


Rice. 12.16. The main window of the AbiWord editor

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 work yet. In version 0.7.8, this included features such as numbered list creation, styles, pagination, and character insertion. Instead of executing the corresponding function, a message appeared: "not implemented yet" ("not implemented yet"). 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 of the bugs are still not fixed. In particular, if you simply highlight a directory in the file open dialog box and try to navigate to it by pressing the ‹Enter› key, a new instance of the program is called. True, the current directory for this new instance is the directory we wanted to go to, but needlessly opening new windows is annoying (and a waste of resources). If you double-click to go to the directory, a new window will not open. There are other errors, and with some, the editor simply closes, without warnings and 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 to be 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 emergence of a full-fledged product that implements all the features declared in the menu is not far off.

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

12.7.5 KWord word processor

The KWord word processor is included office suite kOffice. However, unlike StarOffice, it does not require any generic shell or generic office desktop to run. After starting the program (the easiest way to do this is from the main menu of the KDE shell by selecting the item Office | word processor), an unpretentious gray window appears (see Fig. 12.17), against which a window for selecting the type of document to be opened immediately appears (Fig. 12.18).


Fig.12.17. The start window of the KWord program


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 it is also possible to view a list of those documents with which you worked in previous sessions and quickly call one of them.

As soon as you called up a document for editing, or opened a new one, the appearance of the window changes dramatically (Fig. 12.19). There are also new menu items and toolbars and page formatting rulers.


Rice. 12.19. The main window of the KWord program

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

In Russified Linux versions among these fonts there are also fonts in KOI8-R and cp1251 encodings. Select one of them and start typing. By the way, the main characteristics of the font can also 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 converting 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. Font selection in KWord

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

Tab Frame allows you to enclose this 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 we get a chance).

Next item on the menu Format allows you to set the format of the entire page. After selecting an 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), 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, we note that, just as for choosing a font, it is not necessary 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 shift the paragraph to the right. In addition to the paragraph formatting toolbar, you can use the rulers on the left and at the top of the text input window. These rulers allow you to set page margins and paragraph indents.

So, if you have finished entering the test, or at least typed a whole page, you can see how this 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 in the page image, you can go back to formatting the page and paragraphs so that after making changes, go back to preview. Only 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 our work, let's save the file to 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 choose the directory where the new file will be.

Since we looked at the menu File, let's see what other items it has. In general, nothing unexpected is found here. Items available New, Open, Open Recent, Save, Save As, Create Template From Document, Statistics(in this paragraph you can get information about the number of characters, words and sentences in the typed text), Printing, Print Preview, Document Information(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 items Cancel(previous action), Repeat(i.e. redo the undone action), Cut, Copy, Paste, Select All(i.e. select all), Search and Replacement.

But the next menu for MS Word users will be unusual. 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, items are found here:

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 an 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 this moment the cursor is located.

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

There are two toggles below: Page mode and preview mode. In mode Page mode the edit 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 yet unactivated (I worked with version 1.1 post-beta of KWord) item Nonprinting characters, followed by three more radio buttons: 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 design element of the page, 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 choose one of the preset values.


Rice. 12.22. Header and footer options

Since we are talking about headers and footers, it is 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 each for the header and footer (see Figure 12.22).

In one of the headers and footers, the current page number is usually displayed. In KWord this can be done from the following menu - Insert. You must select an item Variable and select from the list that appears PageNumber.

In general, through the menu Insert you can insert a picture, table, formula, special character, page break, content, variable, expression (Expression), text frame, frame with a picture, frame with an object (Object Frame). It's really hard to work with pictures. Clicking on the picture does not bring up a menu or any symbols that serve to change the size. You have to manage to click on the picture frame in the left upper 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, clinging to which, you can resize the image.

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


Rice. 12.23. Frame setup window (frames)

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

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

On the menu Tools we see three points: Spell Checker, User Variables and AutoCorrect. The spell checker is a graphical front end to the built-in call to the ispell program. When an unfamiliar word is found, it is highlighted and the window shown in Fig. 12.24. You can replace the word with one of the suggested options or skip it ("ignore" the error). You can also directly correct a word in the suggested replacement string, and then click Replace.


Rice. 12.24. Possible reactions to misspelled words

Paragraph User variables serves to define its own variables, and the item AutoCorrect- to set rules for automatic correction of the most typical and frequently encountered errors, such as two capital letters at the beginning of a word. You can change the replacement rules or define your own.

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

Well, and finally last paragraph main menu, which has the traditional KDE structure: help for the program, 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 developers of the program

On this description of the word processor KWord can be considered complete. Unfortunately, so far it cannot be recognized as a fully functional test processor. The main claims are working with figures and tables. But with the Russian language, the processor works quite normally and even allows you to select the character encoding. How to do this in MS Word (if at all possible), I do not know. So for creating not very complex documents, KWord is quite suitable.

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 homepage, and the CD-ROM costs $39.95 (in the US).

StarOffice was originally developed by the German firm StarDivision, which was founded in the mid-1980s. In the summer of 1999, StarDivision was bought along with its development by Sun. The beta version of StarOffice 5.1a, already released on behalf of Sun, had few fundamental differences from those 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 StarOffice 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 satisfies the most demanding requirements. Indeed, StarWriter has a fairly large set of file filters and is quite similar to Microsoft Word in terms of the set of basic operations, so the transition from MS Word to StarWriter should be fairly easy for the user. What's more, 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 the text divided into several columns, insert figures and tables, sidebars into the text, set the 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.). With StarWriter you can create envelopes, labels, letters.

If we talk about when it is worth using StarWriter as a word processor, then first of all we must mention the fact that it is inseparable from the rest of the StarOffice package. StarOffice itself is an integrated graphical environment from which you can run all other applications, so it is quite demanding on resources. Therefore, it is hardly worth using StarWriter in cases where you need to create a small memo or a short e-mail (unless, of course, you use the entire StarOffice package as your working environment).

Unfortunately, even version 5.2 of StarWriter is not fully Russified and does not properly process documents created with MS Word, so after a short experiment with this program, I stopped using it. You can read more about the StarOffice package as a whole in A. Fedorchuk's book "Office, Graphics, Web in Linux" [A1.6].

On October 13, 2000, Sun opened source the StarOffice package. This created the OpenOffice.org project (notice the prefix .org - as the project's Web page says, this is the correct name for this project, since "OpenOffice" is a registered trademark of some other product).

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

Other innovations include the use of an XML-based file format that facilitates interoperability with other products (and therefore other computer users) and provides a clear future direction for the product. The product includes converters for other common file formats, including the formats of all Microsoft versions 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 invoked with the "soffice." Individual package programs are called by the following commands:

Table 12.3. The names of the programs in the OpenOffice.org package.

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

It was all general information. It's time to tell a little about the 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 - we expand the archive in one of the available directories and run the setup program from the received install directory. To get started, you can choose standard version installation (there are also Minimal and Custom options). The installation went smoothly for me, after which a subdirectory called OpenOffice.org641 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 run by their own names.

The appearance of the program window, of course, is somewhat unusual for an MS Office user. In addition to the usual menu bars 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 was introduced to this program at the last stage of the work on this book, and I do not have the opportunity 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 run into each other (an issue that has already been reported in relation to StarOffice). Attempts to change the font have shown that Helvetica is the most acceptable. The text became generally readable, but the effect of running letters has not been completely eliminated. Inserting a picture (a snapshot of the program window) and a table went without problems (at the same time, when the table was created, its header was immediately formed).

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

The reverse operation - opening in OpenOffice.org a file created in MS Word - also worked successfully. True, initially some lines were displayed 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 appropriate part of the text and changing the font, the text becomes quite readable.

By the way, given short description of the OpenOffice.org package is typed in the swriter program.

Not currently able to work detailed description even the swriter programs, not to mention the rest of the programs in the package, I only want to formulate the first conclusion. The most important thing, in my opinion, is that for the first time it became possible to work under Linux with files created in Microsoft Office. Thus, it is no longer necessary to run emulators in order to view an MS Word file received as an email attachment from any of the Microsoft supporters. And it doesn't matter that while there are complaints about the quality of the image output to the screen. All open products are constantly being improved and developed and shortcomings will be eliminated over time. But the advent of OpenOffice.org breaks the last thread that tied Linux adherents to Microsoft products and allows them to move fully into 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 fail to achieve any acceptable quality of translation, and I think they will not succeed in the near future. The translations created by such programs can simply absurdly change the meaning of what is written. Therefore, I myself do not use such programs and do not advise 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 a must. And such dictionaries exist, in particular for Linux. Naturally, most users first of all need English-Russian dictionaries in order to understand explanations for programs, which in the vast majority of cases are given in English.

I didn't compare electronic dictionaries, the results of which I could offer you here. The first program I came across was slovo, developed by D. Anisimov, to which I am already accustomed, and it suits me perfectly. This program uses Muller's well-known English-Russian Dictionary (although other dictionaries can be connected) and gives the transcription of English words, so that in normal practice it is quite enough.


Rice. 12.26. Slovo program window

Getting a transcription may cause you some difficulties, 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 marks). However, in the manual for the program, which is also attached in the Russian version, the necessary actions are described in detail, so there is no need to explain it here. At least everything worked out for me, I think that everything will be fine with you, too, except that you have to make a little effort.

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

You can select the word that needs to be translated from the list in the upper field, or directly enter it in the input line (the second field from the top). As you type, the highlight moves in the word list 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 transcription in the field located above the translation. Menu item Dictionaries allows you to change the dictionary (not all dictionaries allow you to display transcription, in my case only Muller's dictionary had this property).

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

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


Rice. 12.27. Mova dictionary shell window

In the input line (it is highlighted in yellow), we enter an 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 Readme_mova_koi.txt file attached to it, and in Russian, so no detailed explanation is required here.

Notes:

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

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

A text editor must have an application for any operating system. We have no shortage , But these are graphic editors.

As you know, the real power of Linux lies in the command line. And when you're working on the command line, you need a text editor that can work right inside the terminal.

To that end, today we are going to compile a list best command line text editors for linux.

pressure

If you've been on Linux for quite some time, you must have heard of Vim. Vim is a highly customizable, cross-platform and highly efficient text editor.

Almost every Linux distribution comes with Vim pre-installed. It is extremely popular due to its wide range of features.

Vim can be quite torturous for first time users. I remember the first time I tried to edit text file with Vim, I was completely taken aback. I couldn't type one letter on it, and the funny part is, I couldn't even figure out how to close this thing. If you're going to use Vim, you'll need to make up your mind to get up a very steep learning curve.

But after you've gone through it all, combed through some documents, memorized your commands and shortcuts, you'll find that the hassle was worth it. You can flex Vim however you like - customizing your interface, but it seems to work for you, let your workflow get more efficient by using various custom scripts, plugins and so on. Vim supports syntax highlighting, macro photography, and action history.

Like the official website, it states that,

Vim: The power tool for everyone!

It is entirely up to you how you will use it. You can just use it for simple text editing, or you can set it up as a complete IDE.

GNU Emacs

GNU Emacs is undoubtedly one of the most powerful text editors. If you've heard of Vim and Emacs, you should know that both of these editors have a very loyal fan base and often take their text editor very seriously. And you can find a lot of humor and stuff on the internet about it:

Emacs is cross-platform and has a command line interface and GUI. It is also very rich in various features and, most importantly, extensible.

Like Vim, Emacs also comes with a steep learning curve. But once you master it, you can fully use your power. Emacs can handle almost any type of text file. The interface is customizable to suit your workflow. It supports macro photography and shortcuts.

The unique strength of Emacs is that it can be transformed into something completely different from a text editor. There is a large collection of modules that can transform an application to be used in completely different scenarios such as a calendar, news reader, word processor, etc. You can even play games in Emacs!

Nano Bamboo Fiber

When it comes to simplicity, Nano is one thing. Unlike Vim or Emacs, the learning curve for nano is almost flat.

If you just want to create and edit a text file and get on with your life, look no further than Nano.

The shortcuts available on the Nano are displayed at the bottom of the user interface. Nano includes only the basic features of a text editor.

It is minimal and ideal for editing system and configuration files. For those who don't need advanced features from a command line text editor, Nano is the perfect match.

A text editor may be required at any moment, for example, to write code or simply change the configuration file. In the Linux operating system, there are a great many of them, and they behave differently and have their own strengths and weaknesses. Many text editors provide features that will be useful to programmers, such as syntax highlighting, automatic indentation, etc. Such tools allow you to understand at a glance that the entered code is generally correct, the blocks are correctly nested to each other. Syntax highlighting highlights keywords, and also shows 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 circumstance is the editor's ability to work in a text console. This is useful when the graphical shell has refused to work, but it is necessary to make some adjustments to the system configuration files.

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

Nano is one of the most simple editors. He has no support useful features for the programmer. As a plain text editor, it does its job well. The main commands that perform actions are listed at the bottom of the screen, they are enough 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 available 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 extend its functionality to infinity. Kate works only in graphical mode, which in turn allows developers to focus on its advantages and get a solid editor with a set of features. It is quite accessible for beginners. Kate is an editor for programmers and 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 the 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 possibility of the editor is the selection of any text and the implementation of the misspelled words using Google.

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

The command is launched vim.

This text editor does not leave anyone indifferent, it is the most powerful application. Additional functions Emacs are invoked by various keyboard shortcuts. The disadvantage of the editor is, due to its extensibility, it is greedy for RAM. Although for a modern computer this is not a particular problem. In fact, Emacs is an Editor Macros editor with macros, which is why it has gained popularity. It can be used as a web browser mail client, for him even simple games are written 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 both in 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 a set of functions is very well built.

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

The command is launched 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 any of the tasks. It has functions for programmers, such as syntax highlighting, indentation, etc. However, its functions are so primitive that they are unlikely to please programmers. About extensibility through plugins or through shell script execution with open file there is no talk. Spell check and then turned out to be defective. The editor is quite suitable as a regular notepad, for writing ordinary notes.

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