Jump to content

Refining the Nano Editor on Linux


Recommended Posts

How to display line numbering in the nano editor by default?
How can I make very long text on a single line fit in the console window of the nano editor?
How do I enable text selection?
All of these questions will be answered in this topic.

First, make sure that you have the nano editor installed.

sudo apt-get install nano

Next, go to the local configuration file of the nano editor on your linux system. It does not matter whether you are using a desktop or a server distribution.

sudo nano ~/.nanorc

In this configuration file you can customize the nano editor to suit you.
My example:

image.png

set linenumbers                                                                                                          
set backup                                                                                                               
set mouse
set indicator                                                                                                            
set softwrap
  • set linenumbers (Display line numbers to the left of the text area. (Any line with an anchor additionally gets a mark in the margin.))
  • set backup (When saving a file, create a backup file by adding a tilde (~) to the file’s name.)
  • set mouse (Enable mouse support, if available for your system. When enabled, mouse clicks can be used to place the cursor, set the mark (with a double click), and execute shortcuts. The mouse will work in the X Window System, and on the console when gpm is running. Text can still be selected through dragging by holding down the Shift key.)
  • set indicator (Display a "scrollbar" on the righthand side of the edit window. It shows the position of the viewport in the buffer and how much of the buffer is covered by the viewport.)
  • set softwrap (Display lines that exceed the screen’s width over multiple screen lines. (You can make this soft-wrapping occur at whitespace instead of rudely at the screen’s edge, by using also set atblanks.))

You can find a complete list of settings at https://www.nano-editor.org/dist/latest/nanorc.5.html

Note that "softwrap" does not move the line to a new one to fit your text into the console window. Everything stays on one line. Therefore, it does not build a new line.

P.S. Vim is Sucks.

Link to comment
Share on other sites

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
  • Create New...

Important Information

By using this site you automatically agree to the Privacy Policy | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.