Menu
Is free
check in
the main  /  Firmware / Nano Save the file. Working with the Nano Editor: Basic Keyboard Teams

Nano Save file. Working with the Nano Editor: Basic Keyboard Teams

Hotkeys for Nano. He is incomplete - lacks some combinations that I could not check in action. Either, because the yoga is not engaged, whether the GNOME settings are as follows that some combinations or individual keys are intercepted by them - for example, Alt- (and Alt-) combinations. When they are set, it is necessary to use SHIFT (i.e. alt- (on conventional keyboard Converted to Alt-Shift- [). And on me on Alt-Shift in the system just attached to the change of layouts. She overlaps those hotkeys that I send to Nano. But, this is all the lyrics and lack of time, but the list

  • HOME. \u003d Ctrl-A
  • End. \u003d Ctrl-E
  • Pgup. \u003d Ctrl-y
  • PGDN. \u003d Ctrl-V
  • Cursor keys \u003d Ctrl- (F, B, N, P)
  • Tab. \u003d Ctrl-I
  • Backspace. \u003d Ctrl-H
  • Delete. \u003d Ctrl-D
  • Return. \u003d Ctrl-M
  • Help - Ctrl-G
  • Output - Ctrl-x
  • Save file - Ctrl-O
  • Switching syntax - Alt-y
  • Go to the next word - Ctrl-space
  • Go to the previous word - Alt-Space
  • Go to the beginning of the line - Home.
  • Go to the end of the string - End.
  • Go to the next paragraph - Alt-0
  • Go to the previous paragraph - Alt-9
  • Next page - PGDN.
  • Previous page - pgup.
  • Go to line number - Ctrl-_
  • Go to the end of the file - Alt- /
  • Go to the beginning of the file - Alt- \\
  • Go to the appropriate bracket - Alt-]
  • Rewind down - Alt- \u003d.
  • Rewind - Alt-
  • Switching text selection mode - Ctrl-6 (Ctrl- ^). One of the few combinations in which 6, and ^ is unambiguous (i.e., for ^, you do not need to press SHIFT). To select the text, after switching on the selection mode, you must use the cursor keys.
  • Copy current selection - Alt-6 (Alt- ^ or Ctrl-K Ctrl-U). Another combination that does not require pressing Shift for ^.
  • Cut current selection - Ctrl-K
  • Insert - Ctrl-u
  • Insert the contents of the file to the new buffer - Ctrl-R<имя файла>. If you need to insert the contents of the file into the current buffer in place after the cursor, you must first turn off the Multi-Buffer Mode from Nano. This is done using the ALT-F combination.
  • Insert the output of the team - Ctrl-R Ctrl-X
  • Search - Ctrl-W
  • Find the following entry (Find Next ...) - Alt-w or Ctrl-W Enter
  • Find-replace - Ctrl- \\ or Alt-R
  • Help search - Ctrl-W Ctrl-G
  • Align the current paragraph over the width (in which the cursor is located) - Ctrl-J
  • Align the entire document in width - Alt-J

I mentioned Multi-Buffer Mode is Nano mode, in which you can edit multiple files simultaneously. Switching between multiple buffers is performed using Alt-, and Alt- combinations. .

I also mentioned about the syntax highlight.

The syntax backlight, like other Nano settings, must be prescribed in the Nanorc file. For the current user, this file is usually lies here ~ / .nanorc, and an example with a configuration can be taken from /usr/share/doc/nano/examples/nanorc.sample.gz

In Ubuntu, you can find ready-made configurations with highlighting the syntax / usr / Share / Nano /. This directory contains Nano configuration files, one for each type of backlight. By default, they are included.

If you need to change the colors and other backlight settings, you can also see ready-made syntax backlit configurations. You can change files both in / usr / share / nano and in the home directory in the .nanorc file. In the first case, the changes will be globally, in the second - only for the current user.

And UNIX-like operating systems.

GNU Nano is a clone a lot of famous Pico editor. It was developed in 1991 and initially had a TIP name. True, in 2000 he was renamed. Official resource -nano-editor.org..

The new editor is based on the Curses library and distributed under gNU license GPL. Today it is included in the default Ubuntu distributions and it is not needed to install.

Where to get started? To start the console editor, you must open the terminal (you need to find it in the Application-Standard menu) and execute the command:nano. . To create and open the file, the command -# Nano name File .

To work with him you will need only the keyboard. Move the mouse.

In essence, Nano is designed to emulate the functionality and convenience of the original UW PICO. The editor is divided into 4 parts. The first displays the version of the program, the name of the file and current changes in him. The second is a file that is edited on this moment. The third lower part shows important messages. The fourth shows those combinations that are most commonly used.

The editor is controlled by a key combination. Consider examples: save the current documentctrl + O. , access to the search menuctrl + W. , obtain accessible keyboard shortcutsctrl + G. . Also used combinations with meta-keys, for example,meta + S. - Enable or turn off smooth scrolling.

An easy-to-study Nano is suitable for newbies users, however, with configuration tasks perfectly copes.Improved version of Nano 2.0 distinguished himself with its relevant opportunities : Support UTF-8 encoding, improved syntax highlighting, the ability to copy text without cutting it, the possibility of printing each character that was pressed on the keyboard, repeat the last search W / O request (Meta-key + W / Ctrl + W), spell check / replacement only selected section of text, shift to the right of selected text, move to the beginning and end of paragraph, search in the shell file Manager, File Transformation of different format automatically one in one.

Main teams in Nano:

  1. to call a full prompt catalog -Ctrl + G or F1 ;
  2. to leave the program -Ctrl + x or F2 ;
  3. to record the next file - Ctrl + O or F3 ;
  4. to insert the file in the next - Ctrl + R or F5 ;
  5. to search for text in the next file -Ctrl + W or F6 ;
  6. to replace text in the next file -Ctrl + \\ (F14 or META + R) ; First, the replacement text is entered, then, after pressing ENTER - replaceable;
  7. for migration to pre-screen -Ctrl + Y (F7 or PGUP) ;
  8. for migration to the upcoming screen -Ctrl + V (F8 or PGDWN) ;
  9. Ctrl + K (F9) \u003d Delete (cut, cut) a string at the cursor position while saving it in the buffer (cutbuffer);
  10. to insert the contents of CutBuffer in the row in the position of the marker Ctrl + U - (F10) ; If the latter has not changed - the role of UNDO (cancellation), unable not provided for; It is possible to use for unlimited cloning strings in an arbitrary part of the text - you only need to remove the cursor to the right place;
  11. to display information about the position of the cursor in the form -Ctrl + C (F11) ;
  12. to check spelling (through external program SPLELING, if it is installed and enabled the corresponding option in the config, see below) -Ctrl + T (F12) ;
  13. to migrate a marker (cursor) for one line up - Ctrl + P. ;
  14. to migrate a marker one line down -Ctrl + N. ;
  15. to migrate a marker for one symbol forward -Ctrl + F. ;
  16. to migrate a marker for one symbol back -Ctrl + B. ;
  17. to migrate a marker to the beginning of the next line -Ctrl + A. ;
  18. to migrate a marker at the end of the next line - Ctrl + E. ;
  19. for redrawing the next screen -Ctrl + L. ;
  20. to selection (and room in the buffer) of the text, starting with the next position of the cursor - Ctrl + ^ (Meta + A) ;
  21. to eliminate the symbol in the position of the marker -Ctrl + D. ;
  22. to eliminate the symbol to the left of the marker -Ctrl + H. ;
  23. to insert the tab symbol -Ctrl + I. ;
  24. for autofill the next paragraph - Ctrl + J (F4) ;
  25. to insert the line translation symbol (CR) in the marker position -Ctrl + M. ;
  26. to go to the destine line number - Ctrl + _ (F13 or META + G) .

As we wrote above, Use the Meta key you can also execute commands. List of commands with Meta:

  1. for connecting i / disconnect the permanent position of the marker -Meta + C. ;
  2. for connecting i / disconnect autottes -Meta + I. ;
  3. for connecting i / disconnect suspension - Meta + Z. ;
  4. for connecting i / disconnect the output zone prompt -Meta + X. ;
  5. for connecting i / disable PICO editor emulation mode - Meta + P. ;
  6. for connecting i / disable words transfer mode - Meta + W. ;
  7. for connecting i / disable mouse support (only when assembling with GPM support - Meta + M. ;
  8. for the command to allow / disable cutting to the end - Meta + K. ;
  9. for connecting i / off use regular expressions (Regexp) -Meta + E. .

There is also a team that will remove absolutely everything on your PC. Be vigilant, and never do the commands that you are unknown. Check out the combination RM -RF / And equivalent to him: Echo "Test ... Test ... Test ..." | perl -e '$ ?? S :; S: S ;; $? :: s ;; \u003d] \u003d\u003e% - (<-|}<&|`{;;y; -/:[Email Protected][-` (-); `- (/" - ;; s ;; $ _; see ' it may imperceptibly to delete all the information from the computer. Therefore, watch what commands you perform.

And distributed under the GNU GPL license. Currently included in the default Ubuntu distributions and does not need installation.
To start Nano, you should open the terminal and execute:

Nano.

Use options

According to a standard command that allows you to receive a certificate for using the program where you can view the possible options for opening files and other information, you should perform:

Nano --help.

We get the "exhaust" given below. You should repeat the command

Program name --help.

Standard for all console programs.

Usage: Nano [Options] [[+ string, column] file] ... Option Long Form Value -h, -? --Help Show this message + line, Start a column from the specified line and row -a --smarthome to enable the smart home -b button --Backup to save backup copies of existing files -C<дир> --Backupdir \u003d.<дир> Catalog for storing unique backups -d --BoldText to use bold instead of regular -e --tabstospaces Convert tabs in -F --Multibuffer spaces to allow multiple file buffers -h -historylog save and read the search history / replacement strings -i - -gnorcFiles Do not use the Nanorc -K --RebindKeyPad files to correct the problem of a small keyboard -L -L --Nonewlines not to add empty strings at the end of the file -n --noconvert not to convert from DOS / MAC format -O --Morespace Using an optional line -Q.<стр> --Quotestr \u003d.<стр> Quote string -R --restRicted Limited mode -S --Smooth line scroll instead of half-screen -t<#чис> --Tabsize \u003d.<#чис> Set the tab width in the columns -u -quickblank to use fast cleaning status string -V --Version to show version and exit -W --WordBounds Use more accurate definition of word boundaries -y<стр> --Syntax \u003d.<стр> Use the syntax description to highlight -C --Const constantly show the cursor position -d --rebindDelete to correct the backspace / delete -i --outoindent problem automatic indent on the new rows --k --cut cut from the cursor to the end of the string -l --nofollow Not follow symbolic links, rewrite -m --mouse Allow the use of mouse -o<дир> --operatingdir \u003d.<дир> Install the working directory -p --preserve reserve the XON buttons (^ Q) and Xoff (^ s) -Q --Quiet silently ignore the launch errors, such as RC file -R<#столбцы> --Fill \u003d.<#столбцы> Set the line transfer point on the # columns<программа> --speller \u003d.<программа> Use an alternative spell check program -T --temPFILE Auto Maritime Output, without extra questions --U --undo Allow the Cancel function [Experimental] -v --View View Mode (read only) -w --NowRAP Do not transfer long lines - x --nohelp Do not show two rows of help at the bottom --z --Suspend allow suspension - $ --SoftWrap Enable soft string transfer - -B, -E, -F, -G, -J (ignored, for compatibility with PICO )

Nano Assistance Text

Editor Nano. Designed to emulate the functionality and ease of use of the original editor UW PICO.. The editor is divided into 4 main parts: the top line contains a version of the program, the current file name, which is edited, and whether changes were made to the current file. The second part is the main edit window, which displays the editable file. Status Row - 3 Line from below - shows different important messages. Two strings at the bottom show the most frequently used key combinations.

Keyboard key designation system Next: CONTROL combinations are indicated by the symbol (^) and are entered using the Ctrl button or double pressing Escape ESC; Combinations with ESC are indicated by the Meta M symbol and can be entered using the ESC, Alt or Meta buttons, depending on the keyboard used. Also, pressing ESC twice and further entry of the three-digit number from 000 to 255 will introduce the corresponding character.
The following combinations are available in the main edit window. Alternative combinations are shown in brackets:

Ctrl + G or F1 - show this help
Ctrl + X or F2 - close the current buffer / exit Nano
Ctrl + O or F3 - Record the current file on the disk
Ctrl + J or F4 - Align the current paragraph

Ctrl + R or F5 - insert another file in the current
Ctrl + W or F6 - Search Text or Regular Expression
Ctrl + Y or F7 - Go to Previous Screen
Ctrl + V or F8 - go to the next screen

Ctrl + K or F9 - Cut the current line and save it in the clipboard
Ctrl + U or F10 - Insert the contents of the clipboard to the current line
Ctrl + C or F11 - Show the position of the cursor
Ctrl + T or F12 - check spelling if available

m + \\ or M + | - on the first line of the file
M + / or M +? - on the last string of the file

Ctrl + _ or M + G - go to the specified line number and row
Ctrl + \\ or M + R - replace text or regular expression
Ctrl + ^ or M + Alt - Mark text in the current cursor position
M + W - repeat the last search

m + ^ or M + 6 - copy the current line and save it in the clipboard
M +) - increase the indent string
M + (- Reduce the indent string
Ctrl + F - forward to one character
Ctrl + B - Back to one character
Ctrl + Space - Forward on one word
M + Space - Back to one word
Ctrl + P - on the previous line
Ctrl + N - to the next line

Ctrl + Alt - at the beginning of the current line
Ctrl + E - at the end of the current line
M + (or M + 9 - to the beginning of the current paragraph; then the next paragraph
m +) or m + 0 - at the end of the current paragraph; Then next paragraph
M +] - on the appropriate bracket
M + - or M + _ - scroll through one row up without moving the cursor
m + + or m + \u003d - scroll down one row down without moving the cursor
M +.< или m + , - Переключить на предыдущий буфер
M +\u003e or M +. - Switch to the next buffer

m + V - Insert the next key combination as it is
Ctrl + I - Insert a tab in the cursor position
Ctrl + M - Insert a string in the cursor position
Ctrl + D - Delete symbol under the cursor
Ctrl + H - remove the symbol to the left of the cursor
M + T - Cut from the current position until the end of the file

m + J - Align the entire file
M + D - calculate the number of words, rows and symbols
Ctrl + L - update the current screen
Ctrl + Z - Suspend editor (if included)
M + X - Help mode Allow / disable
M + C - permanent position display allow / prohibit
M + O - Using an optional string to edit / disable
M + SHIFT - Smooth Scroll Allow / Disable
M + P - Displays gaps allow / prohibit
M + Y - Syntax Backlight Allow / Disable
M + H - Smart Home Allow / Disable Button
M + I - AutoTensions Allow / Disable
M + K - cut to the end to allow / disable
M + L - automatic breakdown of strings to allow / prohibit
M + Q - Tanning Input Conversion in Spaces Allow / Disable
M + B - Make Backup Copies Allow / Disable
M + F - Multiple File Buffers Allow / Disable
M + M - Support Mouse Allow / Disable
M + N - without conversion from DOS / MAC format / prohibit
M + Z - Suspension Allow / Disable
M + $ - Soft Row Transfer Allow / Disable

Syntax highlighting

On remote servers, Nano can be used to edit configs - a quick, clear, simple text editor, with syntax high. Agree, it is very convenient

1. We find where examples of files are found in our system. Nanorc. On Ubuntu, they are usually in the / usr / share / nano directory. Copy to your directory, configuration file:

$ CP / ETC / Nanorc ~ / .nanorc

2. Add lines to file ~ / .nanorc. (On Ubuntu configuration examples go to delivery) to highlight the files you need, if missing in the standard configuration file:

## Tex Include. "/usr/share/nano/patch.nanorc" ## POV-RAY INCLUDE "/USR/Share/nano/pov.nanorc" ## Perl Include "/usr/share/nano/perl.nanorc" ## Nanorc Files Include "/usr/share/nano/nanorc.nanorc" ## Python Include. "/usr/share/nano/python.nanorc" ## C / C ++ Include "/usr/share/nano/c.nanorc" ## Groff Include "/usr/share/nano/groff.nanorc" ## Assembler include "/usr/share/nano/asm.nanorc" ## Ruby Include "/usr/share/nano/ruby.nanorc" ## manpages include "/usr/share/nano/man.nanorc" ## HTML Include "/usr/share/nano/html.nanorc" ## Bourne Shell Scripts Include "/usr/share/nano/sh.nanorc" ## Sun Java Include "/usr/share/nano/java.nanorc"

3. If this is not enough, then we take the Syntax Highlight Pack and configure the backlight when editing all and everything.

,

The times when Linux was presented with a puzzle-puzzle novice, long ago passed. Most popular now Linux. - Distributions have a convenient and intuitive graphical interface, as well as the regular program programs supplied with them. But there are exceptions. Text editor Nano., for example, does not have GUI. Using the command line interface instead. Why do you need, if there is a gedit?


Nano. used mainly in server Linux., it is convenient when editing configuration files and, if you still decide to master the terminal, it will be very desirable to master and Nano.. There is nothing particularly difficult in this, from all console text editors Nano. It is the easiest thing to use them, it is enough to know the basic key combinations, with which work is underway with files and text.

Installation and Starting

In recent versions Ubuntu. editor Nano. Present by default, and therefore does not need to be installed.

To run it, you need to open the terminal and execute the command nano. . If the terminal responds to the message "The team is not found" Or something like that, then it will mean that the editor is not installed. In this case, it will be necessary to install it by performing this command immediately in the console:

sudo Apt-Get Install Nano

To run the editor, one team is enough - nano. . This will create a new file in the current directory. Determine exactly which folder is current, you can command pwd. in the terminal. If you need to open a specific file, specify its name, and in the case of its location in a folder other than the current, add the full path to it, as shown by the example of the second command:

nano Hello.tht.
nano /home/kompick/hello.tht.

As for configuration files, when they open after nano. Add key -w.This is important because it turns off the row transfer that is not used in system files. The editor interface is represented by the console window, at the top of which the version of the program and the name of the current file are specified, as well as the status (Was it changed or not) . At the bottom of the window there are two rows, showing the most frequently used key combinations. At the bottom, the status bar is also displayed, in which various messages and fields for commands are displayed, for example, the F6 button launches the search by text.

Basic principles of work with the editor Nano

Hot keys designations can be somewhat embarrassed by a novice user, but it is just at first. Symbol (^) means the ctrl key, and (M) Meta - ALT or ESC key. All this can be found in the built-in help. nano.Caused by clicking ^ + G., that is, Ctrl + G.

To move along the content, you can use the arrow keys, to save the changes - Ctrl + O followed by entering Y. To confirm I. N. For cancellation. At the time of saving, the editor requests the name of the file to be entered into the special field at the bottom of the window.

To cancel the changes made to another unsaved file, you need to press Ctrl + C. For cutting whole lines and paragraphs in nano. The combination of Ctrl + K corresponds to their insert - Ctrl + U. To highlight certain elements of the string, Ctrl + 6 or Alt + A is used to call the search string - Ctrl + W or F6. Ctrl + A and Ctrl + E commands allow you to quickly move to the top and end of the string, Ctrl + Y and Ctrl + V commands - scroll down the contents of the text file down and up. Finally, Ctrl + x is used to exit the editor to the terminal.

But all this is only part of the functionality nano.. The editor is supported by counting words, rows and symbols, work immediately with multiple files, creating backup copies of editable documents, using the mode "only for reading", Enabling partial mouse support, syntax description for backlight, change the tab width, turn on the auto storage function of the file when leaving and more. Additional parameters are specified mainly when starting the editor, but some, for example, responsible for backing up the key -b. Can be used while saving a file.

Of the additional features nano. It is worth noting the appearance of the appearance of the console window.

The Nano editor may well play the role of a kind of shock absorber for a novice user. Yes, it is not Emacs, and not even Joe. But with the configuration task copes successfully. And in the development and circulation - simple as a rake. It is not by chance in many Linux distributions it is offered as a system-wide. In Gentoo Linux, where when installing the need for manually editing configuration files, it occurs quite often - this is just the only editor available at the system installation stage. In Crux and Archlinux, it is true, during installation, it is adjacent to the VI - imitating the very, original, and therefore it may also be preferable.

The Nano editor starts on the string command with the following Nano / path / file / file path syntax / file. Fig. one

If you specify a non-existent file, it will be created.

After starting the described command above, you will see something similar in Fig. 2.

I think it makes no sense to explain that moving the cursor, as well as the removal of the text is made by the appropriate keyboard keys, as in other editors. Managing other NANO functions is carried out with the help of control sequences, the list of which is taken from http://posix.ru/apps/nano_editor / and is shown below.

In Nano, there are two types of control sequences - actually managers, Control+ letter and meta-sequence, Meta.+ letter. Through the first to edit text and operations with files. Control sequences are partially duplicated by function keys. F1-F16 (call F13-F16 - Through a combination Shift.+F1-F4.). Meta sequences are designed to change the settings of the editor (the same result is achieved and command line options).

Let me remind you that on the PC keypad, the META key role usually performs the keystroke Alt. (in some layouts - specifically Alt."And right, or, on the contrary, left), or pressing and vacation key Escape..

All major Control sequences are listed below the terminal window.

Control sequences - the following (in brackets - duplicate function keys and, sometimes, META sequences):

    Control+G. (F1) - call the full tip menu;
  • Control+X. (F2.) - exit from the program;
  • Control+O. (F3.) - recording the current file;
  • Control+R. (F5.) - the insertion of the file in the current one;
  • Control+W. (F6) - search text in the current file;
  • Control+\ (F14 or Meta.+R.) - Replacing the text in the current file; first introduced the replacement text, then after clicking ENTER - replaceable;
  • Control+Y. (F7. or Pgup.) - Move to the previous screen;
  • Control+V. (F8. or PGDWN.) - Move to the next screen;
  • Control+K. (F9.) \u003d Delete (cut, cut) a string in the cursor position while saving it in the buffer (cutbuffer);
  • Control+U. - (F10.) - inserting the contents of cutbuffer "and in a string in the cursor position; if the latter has not changed, it acts as UNDO (cancel), it is not standard; it can also be used for unlimited cloning of strings in an arbitrary part of the text - sufficiently after deletion move the cursor to the right place after the removal;
  • Control+C. (F11) - withdrawal information about the position of the cursor in the form of BP
  • Control+T. (F12.) - Checking spelling (through the external spherling program, if it is installed and includes the corresponding option in the config, see below);
  • Control+P. - Move the cursor to one row up;
  • Control+N. - Move the cursor to one line down;
  • Control+F. - Move the cursor to one symbol forward;
  • Control+B. - move the cursor to one character back;
  • Control+A. - Move the cursor to the beginning of the current line;
  • Control+E. - Move the cursor at the end of the current line;
  • Control+L. - redrawing the current screen;
  • Control+^ (Meta.+A.) - the selection (and room in the buffer) of the text, starting with the current position of the cursor;
  • Control+D. - removal of a symbol in the cursor position;
  • Control+H. - removal of the symbol to the left of the cursor;
  • Control+I. - Insert the tab symbol;
  • Control+J. (F4.) autofill the current paragraph;
  • Control+M. insert a string translation symbol (CR) in the cursor position;
  • Control+_ (F13 or Meta.+G.) - Go to the specified row number.

Meta sequences usually work as switches. With their help, the following actions are performed:

  • Meta.+C. - enable / disable the permanent position of the cursor;
  • Meta.+I. - Turn on / off autottes;
  • Meta.+Z. - switching on / off suspension;
  • Meta.+X. - turn on / off the output zone of the prompt;
  • Meta.+P. - Enable / disable the PICO emulation mode;
  • Meta.+W. - enable / disable word transfer mode;
  • Meta.+M. - Enable / disable mouse support (only when assembling with GPM support;
  • Meta.+K. - Allow / disable cutting to the end;
  • Meta.+E. - Enable / disable the use of regular expressions (Regexp).
In addition, the Nano also provides an external configuration tool - user config ~ / .nanorc. After performing some manipulations in it, you can slightly expand the functionality of the editor, in particular, to provide the syntax highlight.