How to Set Custom Configuration Features for the GNU nano Editor

Some people say that there’s a war on among the users of different text editors, and people generally choose between vi/vim or emacs if they’re going to participate. Rather than get involved, it’s probably best to say that both vi and emacs have some really great aspects that are hard to beat, but there are several hidden features in GNU nano that might make people take another look at it. These hidden features can be unlocked either by issuing command line options each time it’s started, or by editing the  file to include them as defaults. Setting custom configuration features in this way will prevent the need for reentering these options each time.

Individuals who worked as system administrators on say a 32-bit distribution of Microsoft Windows Server who have now come over to a Linux or BSD-based server architecture might have gotten used to the full-screen MS-DOS Editor that’s been a standby since Windows 95. The same might be said of those who actually still work with Windows Server, but have the Cygwin libraries or Windows 10 Ubuntu support installed. In either case, you can actually use these features to configure GNU nano to function more like the MS-DOS Editor.

Method 1: Using Additional nano Features from the Command Line

If you only need to call these features occasionally, then you can use command line switches to activate them. To make the Home key jump to the beginning of non-white space characters, which is a favorite of many system administrators, use the -A switch after nano at the CLI prompt. Use -L to disable nano’s habit of adding a new line character to the end of every file. While this is standard behavior in a Unix environment, it’s strange for many people who are used to using MS-DOS utilities.

By default, nano leaves a blank line underneath the title bar, which takes up room. Start nano with -O after it before the file name to use this blank line as another line to display text you’re about to edit. Keep in mind you could use multiple features together. For instance, nano -ALO theFile.txt would open a file called theFile.txt for editing, but wouldn’t add a new line character to it while also eliminating the unnecessary blank line and allowing smart use of the home key.

Users of the MS-DOS Editor might also want to use -m to enable mouse support. Clicking on any line positions the cursor, while a double click sets a mark. Clicking the options at the bottom of the screen in this mode will activate them as well.

This can also help with the built-in file browser. When you use CTRL+O to save a file or CTRL+R to open one, you’re prompted to type one in. However, if you push CTRL+T, you’re given a primitive file browser to select one, which also accepts mouse input if this option is set.

When working with shared Linux, BSD, Windows and even Apple-based server products, you might not want nano to automatically convert between different types of text file formats. Starting it with the -N switch disables automatic conversion. It can read Unix, MS-DOS and even Classic Macintosh text file formats without a problem when this is on.

Method 2: Setting These Options Permanently in nanorc

GNU nano has a global configuration file that’s, by default, at  on most Linux systems, but you can also create one for a single user account at  if different users need their own. Starting nano with the -I option will ignore both of them and only load compiled defaults.

On many *buntu, Debian, Arch and some Fedora systems there’s already a default  file with most options commented out. Use sudo nano  if you’re not root to edit this file, though you’ll more than likely want to make a backup by issuing cp  ~ first. You can delete the backup later once you have everything the way you like it.

Each option merely needs to be included for nano to accept it as a new default. Put them each on a new line, and don’t save the file as MS-DOS or Macintosh text. You may want to use set morespace to eliminate that blank line below the title, set mouse to keep the mouse always active when you’re using a graphical terminal, set regexp to allow regular expressions in searches and set smarthome to always default to smart home key behavior. Using set nonewlines will keep nano from adding new line characters to the end of files you open.

If you’re a system administrator more used to working with Microsoft’s command line tools, then you’ll probably want to use set softwrap in your nanorc file. This enables soft line wrapping by default, which is easier to work with since it wraps long lines to the edge of the screen. Using this function prevents the display of $ symbols to separate long lines in the display, though it’s slightly counterintuitive when it comes to cursor movement. GNU nano will still treat long lines as single lines even when they’re wrapped to the edges of the display, which means you won’t be able to position the cursor in the middle of them without waiting while moving the arrow keys or using the mouse with set mouse on.

Many Windows users are accustomed to having CTRL+S mean save, though this isn’t the default in GNU nano, where CTRL+S actually has an archaic binding. It’s easy enough to change this by using bind ^S savefile main on its own line.

You’re also given the option to set titlecolor, statuscolor, keycolor and functioncolor. After each of these except for keycolor, specfiy two colors separated by a comma with no space. You can use a single color after the set keycolor command. What colors you have to choose from depend partially on your display settings, but you can specify bright before a color with no space before the color name in order to make it bright.

Some adminstrators may wish to use set titlecolor brightwhite,blue and set statuscolor brightwhite,blue to evoke a classic feel, though brightwhite and red was used in the example as this is quite a striking combination that’s easy to read in the Xubuntu terminal used to test it.

Kevin Arrows


Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.

Expert Tip

How to Set Custom Configuration Features for the GNU nano Editor

If the issue is with your Computer or a Laptop you should try using Restoro which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Restoro by clicking the Download button below.

Download Now

I'm not interested