H329F

                Kut -- Unkut

                usage:
                cat ~/.nanorc
                set regexp
                nano -xxlDO$ [fn]

Nano notes
----------

Once upon a time you asked me is there any gentle way to switch from vim to nano in your "conspectuses-howto's"? Actually, it's quit easy. Just become a member of vim developers group, make a few modifications, for example:

  + autoident-ON is default for certain file types (.c etc.)
    See my "Zesty Paste" note here.

  + Right click switches editor to a "visual" mode,
    also "paste" in putty. So, use Shift+Insert from now on.

Nevertheless, if you want to own microscope, you don't have to "забивать им гвозди", just obtain some hammer as well.

Command line and ~/.nanorc
..........................

Note: To use shown features in older OS-es like Ubuntu 16.04 LTS
      you have to install nano from source:

   wget -c https://www.nano-editor.org/dist/v2.8/nano-2.8.3.tar.xz
   apt-get install ncurses-dev
   tar xf nano-2.8.3.tar.xz
   cd nano-2.8.3/
   ./configure
   make
   sudo make install
   nano -l

:etoN

  nano -l              Show line numbers in front of the text
  nano --linenumbers

Enable regex search-replace

  cat ~/.nanorc
  set regexp

Hot keys
........

Call them "shortcuts".  All shortcuts use lowercase letters. ALT key? Call it "meta".

  ctrl+g -- Help (See Annex A).

Navigation
..........

  >     ctrl+f
  <     ctrl+b
  ^     ctrl+p
  v     ctrl+n.
  home  ctrl+a
  end   ctrl+e
  PgDn  ctrl+v
  PgUp  ctrl+y
  word> ctrl+space
  word< meta+space

Goto: x, y
..........

  ctrl+_ line comma column

Copying, Cutting, and Pasting
.............................

  ctrl+^   start mark
  meta+^   copy on end mark
  ctrl+k   cut on end mark
  ctrl+u   paste

Note: cursor position is not in selection.

More
....

  meta+l  line wrap
  Meta+X  toggle bottom hits

Note. Usually human is motivated by

  + rationality (achieve goal by most efficient way)
  + laziness (modify tool only when needed)
  + conservativity (work have to be done even with older tools)

Saying all this, novice nano user might find a few more commands useful:

  Shortcut   | How to memorize   | Explanation
  -----------+-------------------+------------------------------------
  ALT+a      | A&O               | Start mark
  ALT+^      | Alternatives Dach | Copy to buffer (provide a "Roof" ^)
  ALT+g      | ALT und geh       | Go to line and column number
  CTRL+w     | Was???            | Search for a string
  CTRL+c     | Cursor            | Display the position of the cursor

Annex A. ctrl+g nano v 2.7.4
----------------------------

Main nano help text

The nano editor is designed to emulate the functionality and ease-of-use of the UW Pico text editor.  There are four main sections of the editor. The top line shows the program version, the current filename being edited, and whether or not the file has been modified.  Next is the main editor window showing the file being edited.  The status line is the third line from the bottom and shows important messages.  The bottom two lines show the most commonly used shortcuts in the editor.

The notation for shortcuts is as follows: Control-key sequences are notated with a caret (^) symbol and can be entered either by using the Control (Ctrl) key or pressing the Escape (Esc) key twice.  Escape-key sequences are notated with the Meta (M-) symbol and can be entered using either the Esc, Alt, or Meta key depending on your keyboard setup.  Also, pressing Esc twice and then typing a three-digit decimal number from 000 to 255 will enter the character with the corresponding value.  The following keystrokes are available in the main editor window.

Alternative keys are shown in parentheses:

  ^G    (F1)    Display this help text

  ^X    (F2)    Close the current file buffer / Exit from nano
  ^O    (F3)    Write the current file to disk
  ^R    (F5)    Insert another file into the current one

  ^W    (F6)    Search for a string or a regular expression
! ^\    (M-R)   Replace a string or a regular expression
! ^K    (F9)    Cut the current line and store it in the cutbuffer
! ^U    (F10)   Uncut from the cutbuffer into the current line

  ^J    (F4)    Justify the current paragraph
  ^T    (F12)   Invoke the spell checker, if available
                Invoke the linter, if available
                Invoke formatter, if available

  ^C    (F11)   Display the position of the cursor
  ^_    (M-G)   Go to line and column number

  ^Y    (F7)    Go one screenful up
  ^V    (F8)    Go one screenful down
  M-\   (M-|)   Go to the first line of the file
  M-/   (M-?)   Go to the last line of the file

  M-W   (F16)   Repeat the last search
  M-]           Go to the matching bracket
  ^^    (M-A)   Mark text starting from the cursor position
! M-^   (M-6)   Copy the current line and store it in the cutbuffer

  M-}           Indent the current line
  M-{           Unindent the current line

  M-U           Undo the last operation
  M-E           Redo the last undone operation

  ^B    (Left)  Go back one character
  ^F    (Right) Go forward one character
  ^<- (M-Space) Go back one word
  ^-< (^Space)  Go forward one word
  ^A    (Home)  Go to beginning of current line
  ^E    (End)   Go to end of current line
  ^P    (Up)    Go to previous line
  ^N    (Down)  Go to next line

  ^↑    (M-7)   Go to previous block of text
  ^↓    (M-8)   Go to next block of text
  M-(   (M-9)   Go to beginning of paragraph; then of previous paragraph
  M-)   (M-0)   Go just beyond end of paragraph; then of next paragraph
  M--   (M-_)   Scroll up one line without scrolling the cursor
  M-+   (M-=)   Scroll down one line without scrolling the cursor

  M-<   (M-,)   Switch to the previous file buffer
  M->   (M-.)   Switch to the next file buffer

  M-V           Insert the next keystroke verbatim
  ^I    (Tab)   Insert a tab at the cursor position
  ^M    (Enter) Insert a newline at the cursor position

  ^D    (Del)   Delete the character under the cursor
  ^H    (Bsp)   Delete the character to the left of the cursor
                Cut backward from cursor to word start
                Cut forward from cursor to next word start
  M-T           Cut from the cursor position to the end of the file

  M-J           Justify the entire file
  M-D           Count the number of words, lines, and characters
  ^L            Refresh (redraw) the current screen
  ^Z            Suspend the editor (if suspension is enabled)
! M-3           Comment/uncomment the current line or marked lines

                Save file without prompting

                Search next occurrence backward
                Search next occurrence forward

! M-X           Help mode enable/disable
  M-C           Constant cursor position display enable/disable
! M-O           Use of one more line for editing enable/disable
  M-S           Smooth scrolling enable/disable
  M-$           Soft wrapping of overlong lines enable/disable
  M-#           Line numbering enable/disable
  M-P           Whitespace display enable/disable
  M-Y           Color syntax highlighting enable/disable

  M-H           Smart home key enable/disable
  M-I           Auto indent enable/disable
  M-K           Cut to end enable/disable
  M-L           Hard wrapping of overlong lines enable/disable
  M-Q           Conversion of typed tabs to spaces enable/disable

  M-B           Backup files enable/disable
  M-F           Reading file into separate buffer enable/disable
  M-M           Mouse support enable/disable
  M-N           No conversion from DOS/Mac format enable/disable
  M-Z           Suspension enable/disable

Annex B. nano --help
--------------------

  Option    GNU long option    Meaning
   +LINE,COLUMN                Start at line LINE, column COLUMN
   -A       --smarthome        Enable smart home key
   -B       --backup           Save backups of existing files
   -C <dir> --backupdir=<dir>  Directory for saving unique backup files
   -D       --boldtext         Use bold instead of reverse video text
   -E       --tabstospaces     Convert typed tabs to spaces
   -F       --multibuffer      Read a file into a new buffer by default
   -G       --locking          Use (vim-style) lock files
   -H       --historylog       Log & read search/replace string history
   -I       --ignorercfiles    Don't look at nanorc files
   -K       --rebindkeypad     Fix numeric keypad key confusion problem
   -L       --nonewlines       Don't add newlines to the ends of files
   -N       --noconvert        Don't convert files from DOS/Mac format
   -O       --morespace        Use one more line for editing
   -P       --positionlog      Log & read location of cursor position
   -Q <str> --quotestr=<str>   Quoting string
   -R       --restricted       Restricted mode
   -S       --smooth           Scroll by line instead of half-screen
   -T <#cols> --tabsize=<#cols> Set width of a tab to #cols columns
   -U       --quickblank       Do quick statusbar blanking
   -V       --version          Print version information and exit
   -W       --wordbounds       Detect word boundaries more accurately
   -X <str> --wordchars=<str>  Which other characters are word parts
   -Y <str> --syntax=<str>     Syntax definition to use for coloring
   -c       --constantshow     Constantly show cursor position
   -d       --rebinddelete     Fix Backspace/Delete confusion problem
   -h       --help             Show this help text and exit
   -i       --autoindent       Automatically indent new lines
   -k       --cut              Cut from cursor to end of line
   -l       --linenumbers      Show line numbers in front of the text
   -m       --mouse            Enable the use of the mouse
   -n       --noread           Do not read the file (only write it)
   -o <dir> --operatingdir=<dir> Set operating directory
   -p       --preserve         Preserve XON (^Q) and XOFF (^S) keys
   -q       --quiet            Silently ignore startup issues
                               like rc file errors
   -r <#cols> --fill=<#cols>   Set hard-wrapping point at column #cols
   -s <prog> --speller=<prog>  Enable alternate speller
   -t        --tempfile        Auto save on exit, don't prompt
   -u        --unix            Save a file by default in Unix format
   -v        --view            View mode (read-only)
   -w        --nowrap          Don't hard-wrap long lines
   -x        --nohelp          Don't show the two help lines
   -z        --suspend         Enable suspension
   -$        --softwrap        Enable soft line wrapping

Links
-----

1. The Beginner’s Guide to Nano, the Linux Command-Line Text Editor
    https://www.howtogeek.com/howto/42980
      /the-beginners-guide-to-nano-the-linux-command-line-text-editor/

2. The GNU nano editor FAQ
    https://www.nano-editor.org/dist/v2.7/faq.html

3. How to show line numbering in nano when opening a file
    http://askubuntu.com/questions/73444
      /how-to-show-line-numbering-in-nano-when-opening-a-file