Skip to content

Instantly share code, notes, and snippets.

@ManotLuijiu
Created August 11, 2021 08:03
Show Gist options
  • Save ManotLuijiu/490b1aa97250016379bd979634a4a7cb to your computer and use it in GitHub Desktop.
Save ManotLuijiu/490b1aa97250016379bd979634a4a7cb to your computer and use it in GitHub Desktop.
nanorc manual
NANORC(5) 2021" NANORC(5)
NAME
nanorc - GNU nano's configuration file
DESCRIPTION
The nanorc files contain the default settings for nano, a small and friendly editor. During startup,
if --rcfile is not given, nano will read two files: first the system-wide settings, from /etc/nanorc
(the exact path might be different on your system), and then the user-specific settings, either from
~/.nanorc or from $XDG_CONFIG_HOME/nano/nanorc or from ~/.config/nano/nanorc, whichever is encountered
first. If --rcfile is given, nano will read just the specified settings file.
NOTICE
Since version 4.0, nano by default:
o does not automatically hard-wrap lines that become overlong,
o includes the line below the title bar in the editing area,
o does linewise (smooth) scrolling.
To get the old, Pico behavior back, you can use set breaklonglines, set emptyline, and set
jumpyscrolling.
OPTIONS
The configuration file accepts a series of set and unset commands, which can be used to configure nano
on startup without using command-line options. Additionally, there are some commands to define syntax
highlighting and to rebind keys -- see the two separate sections on those. nano reads one command per
line. All commands and keywords should be written in lowercase.
Options in nanorc files take precedence over nano's defaults, and command-line options override nanorc
settings. Also, options that do not take an argument are unset by default. So using the unset com-
mand is only needed when wanting to override a setting of the system's nanorc file in your own nanorc.
Options that take an argument cannot be unset.
Quotes inside the characters parameters below should not be escaped. The last double quote on the
line will be seen as the closing quote.
The supported commands and arguments are:
set afterends
Make Ctrl+Right and Ctrl+Delete stop at word ends instead of beginnings.
set allow_insecure_backup
When backing up files, allow the backup to succeed even if its permissions can't be (re)set due to
special OS considerations. You should NOT enable this option unless you are sure you need it.
set atblanks
When soft line wrapping is enabled, make it wrap lines at blank characters (tabs and spaces)
instead of always at the edge of the screen.
set autoindent
Automatically indent a newly created line to the same number of tabs and/or spaces as the previous
line (or as the next line if the previous line is the beginning of a paragraph).
set backup
When saving a file, create a backup file by adding a tilde (~) to the file's name.
set backupdir directory
Make and keep not just one backup file, but make and keep a uniquely numbered one every time a file
is saved -- when backups are enabled with set backup or --backup or -B. The uniquely numbered
files are stored in the specified directory.
set boldtext
Use bold instead of reverse video for the title bar, status bar, key combos, function tags, line
numbers, and selected text. This can be overridden by setting the options titlecolor, statuscolor,
keycolor, functioncolor, numbercolor, and selectedcolor.
set bookstyle
When justifying, treat any line that starts with whitespace as the beginning of a paragraph (unless
auto-indenting is on).
set brackets "characters"
Set the characters treated as closing brackets when justifying paragraphs. This may not include
blank characters. Only closing punctuation (see set punct), optionally followed by the specified
closing brackets, can end sentences. The default value is ""')>]}".
set breaklonglines
Automatically hard-wrap the current line when it becomes overlong.
set casesensitive
Do case-sensitive searches by default.
set constantshow
Constantly display the cursor position in the status bar. This overrides the option quickblank.
set cutfromcursor
Use cut-from-cursor-to-end-of-line by default, instead of cutting the whole line.
set emptyline
Do not use the line below the title bar, leaving it entirely blank.
set errorcolor [bold,][italic,]fgcolor,bgcolor
Use this color combination for the status bar when an error message is displayed. The default
value is brightwhite,red. See set titlecolor for valid color names.
set fill number
Set the target width for justifying and automatic hard-wrapping at this number of columns. If the
value is 0 or less, wrapping will occur at the width of the screen minus number columns, allowing
the wrap point to vary along with the width of the screen if the screen is resized. The default
value is -8.
set functioncolor [bold,][italic,]fgcolor,bgcolor
Use this color combination for the concise function descriptions in the two help lines at the bot-
tom of the screen. See set titlecolor for more details.
set guidestripe number
Draw a vertical stripe at the given column, to help judge the width of the text. (The color of the
stripe can be changed with set stripecolor.)
set historylog
Save the last hundred search strings and replacement strings and executed commands, so they can be
easily reused in later sessions.
set indicator
Display a "scrollbar" on the righthand side of the edit window. It shows the position of the view-
port in the buffer and how much of the buffer is covered by the viewport.
set jumpyscrolling
Scroll the buffer contents per half-screen instead of per line.
set keycolor [bold,][italic,]fgcolor,bgcolor
Use this color combination for the shortcut key combos in the two help lines at the bottom of the
screen. See set titlecolor for more details.
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 locking
Enable vim-style lock-files for when editing files.
set magic
When neither the file's name nor its first line give a clue, try using libmagic to determine the
applicable syntax. (Calling libmagic can be relatively time consuming. It is therefore not done
by default.)
set matchbrackets "characters"
Specify the opening and closing brackets that can be found by bracket searches. This may not
include blank characters. The opening set must come before the closing set, and the two sets must
be in the same order. The default value is "(<[{)>]}".
set minibar
Suppress the title bar and instead show information about the current buffer at the bottom of the
screen, in the space for the status bar. In this "minibar" the file name is shown on the left,
followed by an asterisk if the buffer has been modified. On the right are displayed the current
line and column number, the code of the character under the cursor (in Unicode format: U+xxxx), the
same flags as are shown by set stateflags, and a percentage that expresses how far the cursor is
into the file (linewise). When a file is loaded or saved, and also when switching between buffers,
the number of lines in the buffer is displayed after the file name. This number is cleared upon
the next keystroke, or replaced with an [i/n] counter when multiple buffers are open. The line
plus column numbers and the character code are displayed only when set constantshow is used, and
can be toggled on and off with M-C. The state flags are displayed only when set stateflags is
used.
set minicolor [bold,][italic,]fgcolor,bgcolor
Use this color combination for the minibar. (When this option is not specified, the colors of the
title bar are used.) See set titlecolor for more details.
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 multibuffer
When reading in a file with ^R, insert it into a new buffer by default.
set noconvert
Don't convert files from DOS/Mac format.
set nohelp
Don't display the two help lines at the bottom of the screen.
set nonewlines
Don't automatically add a newline when a text does not end with one. (This can cause you to save
non-POSIX text files.)
set nowrap
Deprecated option since it has become the default setting. When needed, use unset breaklonglines
instead.
set numbercolor [bold,][italic,]fgcolor,bgcolor
Use this color combination for line numbers. See set titlecolor for more details.
set operatingdir directory
nano will only read and write files inside directory and its subdirectories. Also, the current
directory is changed to here, so files are inserted from this directory. By default, the operating
directory feature is turned off.
set positionlog
Save the cursor position of files between editing sessions. The cursor position is remembered for
the 200 most-recently edited files.
set preserve
Preserve the XON and XOFF keys (^Q and ^S).
set promptcolor [bold,][italic,]fgcolor,bgcolor
Use this color combination for the prompt bar. (When this option is not specified, the colors of
the title bar are used.) See set titlecolor for more details.
set punct "characters"
Set the characters treated as closing punctuation when justifying paragraphs. This may not include
blank characters. Only the specfified closing punctuation, optionally followed by closing brackets
(see brackets), can end sentences. The default value is "!.?".
set quickblank
Make status-bar messages disappear after 1 keystroke instead of after 20. Note that options con-
stantshow and minibar override this.
set quotestr "regex"
Set the regular expression for matching the quoting part of a line. The default value is
"^([ \t]*([!#%:;>|}]|//))+". (Note that \t stands for an actual Tab character.) This makes it
possible to rejustify blocks of quoted text when composing email, and to rewrap blocks of line com-
ments when writing source code.
set rawsequences
Interpret escape sequences directly (instead of asking ncurses to translate them). If you need
this option to get your keyboard to work properly, please report a bug. Using this option disables
nano's mouse support.
set rebinddelete
Interpret the Delete and Backspace keys differently so that both Backspace and Delete work prop-
erly. You should only use this option when on your system either Backspace acts like Delete or
Delete acts like Backspace.
set regexp
Do regular-expression searches by default. Regular expressions in nano are of the extended type
(ERE).
set saveonexit
Save a changed buffer automatically on exit (^X); don't prompt. (The old form of this option, set
tempfile, is deprecated.)
set scrollercolor fgcolor,bgcolor
Use this color combination for the indicator alias "scrollbar". (On terminal emulators that link
to a libvte older than version 0.55, using a background color here does not work correctly.) See
set titlecolor for more details.
set selectedcolor [bold,][italic,]fgcolor,bgcolor
Use this color combination for selected text. See set titlecolor for more details.
set showcursor
Put the cursor on the highlighted item in the file browser, to aid braille users.
set smarthome
Make the Home key smarter. When Home is pressed anywhere but at the very beginning of non-white-
space characters on a line, the cursor will jump to that beginning (either forwards or backwards).
If the cursor is already at that position, it will jump to the true beginning of the line.
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.)
set speller "program [argument ...]"
Use the given program to do spell checking and correcting, instead of using the built-in corrector
that calls hunspell(1) or spell(1).
set spotlightcolor [bold,][italic,]fgcolor,bgcolor
Use this color combination for highlighting a search match. The default value is black,lightyel-
low. See set titlecolor for valid color names.
set stateflags
Use the top-right corner of the screen for showing some state flags: I when auto-indenting, M when
the mark is on, L when hard-wrapping (breaking long lines), R when recording a macro, and S when
soft-wrapping. When the buffer is modified, a star (*) is shown after the filename in the center
of the title bar.
set statuscolor [bold,][italic,]fgcolor,bgcolor
Use this color combination for the status bar. See set titlecolor for more details.
set stripecolor [bold,][italic,]fgcolor,bgcolor
Use this color combination for the vertical guiding stripe. See set titlecolor for more details.
set suspendable
Allow nano to be suspended (with ^Z by default).
set tabsize number
Use a tab size of number columns. The value of number must be greater than 0. The default value
is 8.
set tabstospaces
Convert typed tabs to spaces.
set titlecolor [bold,][italic,]fgcolor,bgcolor
Use this color combination for the title bar. Valid names for the foreground and background colors
:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment