NANORC(5)
๐ NAME ๐
nanorc โ GNU nano's configuration file. (Yep, this is NANORC(5) from the File Formats Manual, and we're about to make it make sense, bestie.)
โจ DESCRIPTION โจ
The nanorc files contain the default settings for nano, a small and friendly text editor. During startup, if --rcfile is not given, nano reads two files: first the system-wide settings, from /etc/nanorc (the exact path might be different on your system, so vibe check your setup), 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 reads just the specified settings file. Periodt.
๐จ NOTICES ๐จ
Okay so version tea, because this matters. Since version 9.0, all lines are scrolled horizontally together (when the cursor approaches the edge), by just the amount needed, instead of scrolling only the current line by a large step. If you prefer the old behavior, you can use --solo on the command line or set solosidescroll in your nanorc.
Also since version 9.0, keystrokes M-< and M-> have been reassigned to the scrollleft and scrollright functions. If you want those keystrokes to do what they did before version 9.0, add these two lines at the end of your nanorc file:
bind M-< prevbuf main
bind M-> nextbuf main
Since version 8.0, to be newcomer friendly, ^F starts a forward search, ^B starts a backward search, M-F searches the next occurrence forward, and M-B searches the next occurrence backward. If you want those keystrokes to do what they did before version 8.0, add the following four lines at the end of your nanorc file:
bind ^F forward main
bind ^B back main
bind M-F formatter main
bind M-B linter main
๐ธ 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 command 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. No cap.
The supported commands and arguments are:
set afterendsโ MakeCtrl+RightandCtrl+Deletestop 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. Like, fr fr, do not.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 backupdirdirectory โ 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 withset backupor--backupor-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, prompt bar, mini bar, key combos, line numbers, and selected text. This can be overridden by setting the optionstitlecolor,statuscolor,promptcolor,minicolor,keycolor,numbercolor, and/orselectedcolor.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 (seeset 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 โ that is: when it becomes wider than the value given withset fill(which defaults to the width of the terminal minus eight).set casesensitiveโ Do case-sensitive searches by default.set colonparsingโ When a filename given on the command line ends in a colon plus digits and this filename does not exist, then snip the colon plus digits and understand the digits as a line number. If the trimmed filename does not exist either, then repeat the process and understand the obtained two numbers as line and column number. But if the doubly trimmed filename does not exist either, then forget the trimming and accept the original filename as is. To disable this colon parsing for some file, use+1or similar before the relevant filename.set constantshowโ Constantly report the cursor position on the status bar. This overrides the optionquickblank.set cutfromcursorโ Let^Kcut from the cursor to end-of-line, 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 isbold,white,red. Seeset titlecolorfor valid color names.set fillnumber โ Set the target width for justifying and automatic hard-wrapping at this number of columns. If the value is0or less, wrapping occurs 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 bottom of the screen. Seeset titlecolorfor more details.set guidestripenumber โ Draw a vertical stripe at the given column, to help judge the width of the text. (The color of the stripe can be changed withset 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 viewport 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. Seeset titlecolorfor 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โ Use vim-style lock-files when editing files.set magicโ When neither the file's name nor its first line give a clue, try usinglibmagicto determine the applicable syntax. (Callinglibmagiccan 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 โmini barโ the filename 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 byset 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 filename. 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 whenset constantshowis used, and can be toggled on and off withM-C. The state flags are displayed only whenset stateflagsis used.set minicolor [bold,][italic,]fgcolor,bgcolorโ Use this color combination for the mini bar. (When this option is not specified, the colors of the title bar are used.) Seeset titlecolorfor more details.set mouseโ Enable mouse support. This means: a click in the edit window places the cursor, two clicks at the same spot toggle the mark, a click in the help lines executes the touched shortcut, a click in the โscrollbarโ scrolls the buffer to roughly that position, and rolling the wheel scrolls the viewport instead of moving the cursor. (The mouse works in the X Window System, and on the console whengpmis running. Under X, text can still be selected through dragging by holding down the Shift key.)set newbufferโ When reading in a file with^R, insert it into a new buffer by default. (The old form of this option,set multibuffer, is deprecated.)set noconvertโ Don't convert files from DOS 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, useunset breaklonglinesinstead.set numbercolor [bold,][italic,]fgcolor,bgcolorโ Use this color combination for line numbers. Seeset titlecolorfor more details.set operatingdirdirectory โ At startup, makenanochange to the given directory, and allow reading and writing files only in this directory and its subdirectories.set positionlogโ bestie, this one saves where your cursor was and where your anchors were between editing sessions ๐ so you don't lose your place. It remembers these positions for the 200 most-recently edited files. (yes, exactly 200, no more.)set preserveโ keeps theXOFFandXONsequences (^Sand^Q) intact so the terminal catches them instead (aka stopping and resuming the output). let the terminal have its lil moment ๐set promptcolor [bold,][italic,]fgcolor,bgcolorโ use this color combo for the prompt bar โจ (when you don't specify this one, it just borrows the colors of the title bar.) peepset titlecolorfor the deets.set punct "characters"โ sets which characters count as closing punctuation when justifying paragraphs. it may not include blank characters, periodt. only the punctuation you list here โ optionally followed by closing brackets (seeset brackets) โ can end sentences. default is"!.?". ๐set quickblankโ makes status-bar messages dip out after 1 keystroke instead of after 20. note that optionconstantshowoverrides this. and when optionminibarorzerois in effect,quickblankmakes a message disappear after 0.8 seconds instead of the default 1.5 seconds. she's impatient, we love her ๐set quotestr "regex"โ sets the regular expression for matching the quoting part of a line. default value is"^([ \t]*([!#%:;>|}]|//))+". (note that\tstands for an actual Tab character.) this is what makes it possible to rejustify blocks of quoted text when you're composing email ๐ง and to rewrap blocks of line comments when you're writing source code. iykyk.set rawsequencesโ interpret escape sequences directly instead of asking ncurses to translate them. (if you need this option to get some keys working properly, that means the terminfo terminal description in use doesn't fully match what your terminal actually does. this can happen when yousshinto a BSD machine, for example.) ๐ซถ heads up: using this option disables nano's mouse support.set rebinddeleteโ interprets the Delete and Backspace keys differently so that both Backspace and Delete work properly. only use this when, on your system, either Backspace acts like Delete or Delete acts like Backspace. it's giving "fix the chaos" energy ๐ญset regexpโ do regular-expression searches by default. regular expressions in nano are of the extended type (ERE). slay.set saveonexitโ saves a changed buffer automatically on exit (^X), no prompt. no "are you sure" jumpscare, none of that ๐set scrollercolor fgcolor,bgcolorโ use this color combo for the indicator alias โscrollbarโ. seeset titlecolorfor more details.set selectedcolor [bold,][italic,]fgcolor,bgcolorโ use this color combo for selected text ๐ธ seeset titlecolorfor more details.set showcursorโ puts the cursor on the highlighted item in the file browser, and shows the cursor in the help viewer, to aid braille users and people with poor vision ๐ genuinely iconic accessibility behavior.set smarthomeโ makes the Home key smarter ๐ง when Home is pressed anywhere but at the very beginning of non-whitespace characters on a line, the cursor jumps to that beginning (either forwards or backwards). and if the cursor is already there? it jumps to the true beginning of the line. she thinks ahead fr fr.set softwrapโ displays lines that exceed the screen's width over multiple screen lines. (you can make this soft-wrapping happen at whitespace instead of rudely at the screen's edge by also usingset atblanks.) so polite of you โจset solosidescrollโ when the cursor approaches the right edge of the edit window, scroll only the current line sideways by a large amount, instead of scrolling all visible lines sideways by just the amount needed to keep the cursor in view. that second thing โ whole-window smooth sideways scrolling โ is the new default behavior. the single-line jerky sideways scrolling this option enables was the old behavior โ literally the only behavior nano ever knew. nostalgic queen ๐set speller "program [argument ...]"โ use the given program to do spell checking and correcting, instead of the built-in corrector that callshunspell(1)orspell(1). you can bring your own fave ๐ฅset spotlightcolor [bold,][italic,]fgcolor,bgcolorโ use this color combo for highlighting a search match ๐ default value isblack,lightyellow. seeset titlecolorfor valid color names.set stateflagsโ uses the top-right corner of the screen to show some state flags:Iwhen auto-indenting,Mwhen the mark is on,Lwhen hard-wrapping (breaking long lines),Rwhen recording a macro, andSwhen soft-wrapping. and when the buffer is modified, a star (*) shows up after the filename in the center of the title bar โญ tiny dashboard, big vibes.set statuscolor [bold,][italic,]fgcolor,bgcolorโ use this color combo for the status bar. seeset titlecolorfor more details. ๐set stripecolor [bold,][italic,]fgcolor,bgcolorโ use this color combo for the vertical guiding stripe ๐ seeset titlecolorfor more details.set tabsize numberโ use a tab size of number columns. the value of number must be greater than0. the default value is 8.set tabstospacesโ convert each typed tab to spaces โ to the number of spaces that a tab at that position would take up. (note: pasted tabs are not converted. pasted tabs said "i'm not doing that" ๐)set titlecolor [bold,][italic,]fgcolor,bgcolorโ use this color combo for the title bar ๐ valid names for the foreground and background colors are:red,green,blue,magenta,yellow,cyan,white, andblack. each of these eight names may be prefixed with the wordlightto get a brighter version of that color. the wordgreyorgraymay be used as a synonym forlightblack. on a Linux console,lightdoes not have any effect for a background color. on terminal emulators that can do at least 256 colors, other valid (but unprefixable) color names are:pink,purple,mauve,lagoon,mint,lime,peach,orange,latte,rosy,beet,plum,sea,sky,slate,teal,sage,brown,ocher,sand,tawny,brick,crimson, andnormalโ wherenormalmeans the default foreground or background color. on such emulators, the color may also be specified as a three-digit hexadecimal number prefixed with#, with the digits representing the amounts of red, green, and blue, respectively. this tells nano to select from the available palette the color that approximates the given values. ๐
either "fgcolor" or ",bgcolor" may be left out, and the pair may be preceded by bold and/or italic (separated by commas) to get a bold and/or slanting typeface, if your terminal can do those. ๐
set trimblanksโ removes trailing whitespace from wrapped lines when automatic hard-wrapping occurs or when text is justified. clean girl aesthetic ๐งผโจset unixโ save a file by default in Unix format. this overrides nano's default behavior of saving a file in the format that it had. (this option has no effect when you also useset noconvert.)set whitespace "characters"โ sets the two characters used to indicate the presence of tabs and spaces. they must be single-column characters. the default pair for a UTF-8 locale is"ยปโ ", and for other locales">.".set wordboundsโ detects word boundaries differently by treating punctuation characters as parts of words. she's inclusive like that ๐ซถset wordchars "characters"โ specify which other characters (besides the normal alphanumeric ones) should be considered parts of words. when using this option, you probably want tounset wordbounds. pick a lane bestie ๐ญset zapโ lets an unmodified Backspace or Delete erase the marked region (instead of a single character, and without affecting the cutbuffer). efficient. dramatic. obsessed. ๐set zeroโ hides all elements of the interface (title bar, status bar, and help lines) and uses all rows of the terminal for showing the contents of the buffer. the status bar appears only when there's a significant message, and disappears after 1.5 seconds or upon the next keystroke. with M-Z the title bar plus status bar can be toggled. with M-X the help lines. full screen, main character energy, nothing but text โจ
โจ SYNTAX HIGHLIGHTING โจ
okay so bestie, coloring the different syntactic elements of a file? It's all done via regular expressions (peep the color command below). ๐
And like, this is inherently imperfect, because regexes are just not powerful enough to fully parse a file, no cap. ๐ญ
But ngl, regular expressions can do a LOT and they're easy to make, so they're a total good fit for a small editor like nano. periodt. ๐
So all regular expressions in nano are POSIX extended regular expressions. โจ That means ., ?, *, +, ^, $, and several other characters are special. ๐
The period . matches any single character, ? means the preceding item is optional, * means the preceding item may be matched zero or more times, + means the preceding item must be matched one or more times, ^ matches the beginning of a line, and $ the end, \< matches the start of a word, and \> the end, and \s matches a blank. ๐ง It also means that lookahead and lookbehind are not possible. sorry not sorry. ๐ A complete explanation can be found in the manual page of GNU grep: man grep. iykyk
Each regular expression in a nanorc file should be wrapped in double quotes (""). ๐ธ Multiple regular expressions can follow each other on a line by separating them with blanks. ๐ This means that a regular expression cannot contain a double quote followed by a blank. ๐ When you need this combination inside a regular expression, then either the double quote or the blank should be put between square brackets ([]). ๐ซถ
For each kind of file a separate syntax can be defined via the following commands: ๐
syntax name ["fileregex" ...]โ Start the definition of a syntax with this name. All subsequentcolorand other such commands are added to this syntax, until a newsyntaxcommand is encountered. When nano is run, this syntax is automatically activated (for the relevant buffer) if the absolute filename matches the extended regular expression fileregex. Or the syntax can be explicitly activated (for all buffers) by using the-Yor--syntaxcommand-line option followed by the name. The syntaxdefaultis special: it takes no fileregex, and applies to files that don't match any syntax's regexes. The syntaxnoneis reserved; specifying it on the command line is the same as not having a syntax at all.header "regex" ...โ If from all defined syntaxes no fileregex matched, then compare this regex (or regexes) against the first line of the current file, to determine whether this syntax should be used for it.magic "regex" ...โ If no fileregex matched and no header regex matched either, then compare this regex (or regexes) against the result of querying the magic database about the current file, to determine whether this syntax should be used for it. (This querying is done only when libmagic is actually installed on the system and--magicorset magicwas given.)formatter program [argument ...]โ Run the given program on the full contents of the current buffer.linter program [argument ...]โ Use the given program to run a syntax check on the current buffer.comment "string"โ Use the given string for commenting and uncommenting lines. If the string contains a vertical bar or pipe character (|), this designates bracket-style comments; for example,"/*|*/"for CSS files. The characters before the pipe are prepended to the line and the characters after the pipe are appended at the end of the line. If no pipe character is present, the full string is prepended; for example,"#"for Python files. If nothing is specified between the double quotes, then the comment/uncomment function is disabled; for example,""for JSON. The default value is"#".tabgives "string"โ Make the Tab key produce the given string. Useful for languages like Python that want to see only spaces for indentation. This overrides the setting of thetabstospacesoption.color [bold,][italic,]fgcolor,bgcolor "regex" ...โ Paint all pieces of text that match the extended regular expression regex with the given foreground and background colors, at least one of which must be specified. Valid color names are:red,green,blue,magenta,yellow,cyan,white, andblack. Each of these eight names may be prefixed with the wordlightto get a brighter version of that color. The wordgreyorgraymay be used as a synonym forlightblack. On a Linux console,lightdoes not have any effect for a background color. On terminal emulators that can do at least 256 colors, other valid (but unprefixable) color names are:pink,purple,mauve,lagoon,mint,lime,peach,orange,latte,rosy,beet,plum,sea,sky,slate,teal,sage,brown,ocher,sand,tawny,brick,crimson, andnormalโ wherenormalmeans the default foreground or background color. On such emulators, the color may also be specified as a three-digit hexadecimal number prefixed with#, with the digits representing the amounts of red, green, and blue, respectively. This tells nano to select from the available palette the color that approximates the given values.
The color pair may be preceded by bold and/or italic (separated by commas) to get a bold and/or slanting typeface, if your terminal can do those.
All coloring commands are applied in the order in which they are specified, which means that later commands can recolor stuff that was colored earlier.
icolor [bold,][italic,]fgcolor,bgcolor "regex" ...โ Same as above, except that the matching is case insensitive.color [bold,][italic,]fgcolor,bgcolor start="fromrx" end="torx"โ Paint all pieces of text whose start matches extended regular expression fromrx and whose end matches extended regular expression torx with the given foreground and background colors, at least one of which must be specified. This means that, after an initial instance of fromrx, all text until the first instance of torx is colored. This allows syntax highlighting to span multiple lines.icolor [bold,][italic,]fgcolor,bgcolor start="fromrx" end="torx"โ Same as above, except that the matching is case insensitive.include "syntaxfile"โ Read in self-contained color syntaxes from syntaxfile. Note that syntaxfile may contain only the above commands, fromsyntaxtoicolor.extendsyntax name command argument ...โ Extend the syntax previously defined as name with another command. This allows adding a newcolor,icolor,header,magic,formatter,linter,comment, ortabgivescommand to an already defined syntax โ useful when you want to slightly improve a syntax defined in one of the system-installed files (which normally are not writable).
โจ REBINDING KEYS โจ
Key bindings can be changed via the following three commands: ๐
bind key function menuโ Rebinds the given key to the given function in the given menu (or in all menus where the function exists whenallis used).bind key "string" menuโ Makes the given key produce the given string in the given menu (or in all menus where the key exists whenallis used). Besides literal text and/or control codes, the string may contain function names between braces. These functions are invoked when the key is typed. To include a literal opening brace, use{{}.unbind key menuโ Unbinds the given key from the given menu (or from all menus where the key exists whenallis used).
Note that bind key "{function}" menu is equivalent to bind key function menu, except that for the latter form nano checks the availability of the function in the given menu at startup time (and reports an error if it does not exist there), whereas for the first form nano checks at execution time that the function exists but not whether it makes any sense in the current menu. The user has to take care that a function name between braces (or any sequence of them) is appropriate. Strange behavior or even a crash can result when the braced name is unfitting.
The format of key should be one of: ๐
^Xโ where X is a Latin letter, or one of several ASCII characters (@,],\,^,_), or the word"Space". Example:^C.M-Xโ where X is any ASCII character (except[), or the word"Space","Left","Right","Up","Down","Ins", or"Del". Example:M-8.Sh-M-Xโ where X is a Latin letter. Example:Sh-M-U. By default, each Shift+Meta+letter keystroke does the same as the corresponding Meta+letter. But when any Shift+Meta bind is made, that will no longer be the case, for all letters.FNโ where N is a numeric value from 1 to 24. Example:F10. (Often,F13toF24can be typed asF1toF12with Shift.)InsorDel. Ins or Del
Rebinding^M(Enter) or^I(Tab) is probably not a good idea. Rebinding^[(Esc) is not possible, because its keycode is the starter byte of Meta keystrokes and escape sequences. Rebinding any of the dedicated cursor-moving keys (the arrows, Home, End, PageUp and PageDown) is not possible. On some terminals it's not possible to rebind^H(unless--rawis used) because its keycode is identical to that of the Backspace key. ๐
Valid function names to be bound are: ๐
helpโ Invokes the help viewer. ๐cancelโ Cancels the current command. ๐ซexitโ Exits from the program (or from the help viewer or file browser). ๐ชwriteoutโ Writes the current buffer to disk, asking for a name. ๐พsavefileโ Writes the current file to disk without prompting. ๐พinsertโ Inserts a file into the current buffer (at the current cursor position), or into a new buffer when optionnewbufferis set. ๐ฅwhereisโ Starts a forward search for text in the current buffer โ or for filenames matching a string in the current list in the file browser. ๐wherewasโ Starts a backward search for text in the current buffer โ or for filenames matching a string in the current list in the file browser. ๐findpreviousโ Searches the next occurrence in the backward direction. โฌ ๏ธfindnextโ Searches the next occurrence in the forward direction. โก๏ธreplaceโ Interactively replaces text within the current buffer. ๐cutโ Cuts and stores the current line (or the marked region). โ๏ธcopyโ copies the current line (or the marked region) without deleting it. Duplicate but make it legal, bestie. โจpasteโ drops the text you currently have stored into the current buffer, right at the current cursor position. ๐zapโ throws away the current line (or the marked region). Likecopybut with absolutely zero regrets. (This function is bound by default to Meta+Delete.) ๐chopwordleftโ deletes from the cursor position back to the beginning of the word before it. (This function is bound by default to Shift+Ctrl+Delete. And heads up: if your terminal spits out^Hfor Ctrl+Backspace, you can rebind^Hto this function so that Ctrl+Backspace deletes the word to the left of the cursor. iykyk ๐ซถ)chopwordrightโ deletes from the cursor position forward to the beginning of the next word. (This function is bound by default to Ctrl+Delete.)cutrestoffileโ cuts all the text from the cursor position to the end of the buffer. Scorched earth, but ctrl-Z-able. ๐ฅmarkโ sets the mark at the current position so you can start selecting text. Or, when the mark is already set, unsets it. Toggle queen. ๐locationโ reports where the cursor currently is in the buffer: the line, the column, and the character positions. A little GPS for your cursor. ๐wordcountโ counts and reports on the status bar how many lines, words, and characters are in the current buffer (or in the marked region).executeโ prompts you for a program to execute. That program's output gets inserted into the current buffer โ or into a new buffer whenM-Fis toggled. And here's the slay part: when the program's name is preceded by a pipe symbol (|), the current buffer (or the marked region) is piped to the program, and the program's output replaces the buffer (or the marked region). Pipes? In my text editor? It's more likely than you think. ๐ฆspellerโ invokes a spell-checking program: either the defaulthunspell(1), or GNUspell(1), or whatever one you defined with--spellerorset speller.formatterโ invokes a full-buffer-processing program (if the active syntax defines one). Here's the mechanics, no cap: the current buffer is written out to a temporary file, the program is run on that file, and then the temporary file is read back in, replacing the contents of the buffer. ๐linterโ invokes a syntax-checking program (if the active syntax defines one). If that program produces lines shaped likefilename:linenum:charnum: some message, then the cursor gets parked at the indicated position in the mentioned file whilesome messageshows up on the status bar. You can hop from message to message with PgUp and PgDn, and dip out of linting mode with^Cor Enter. ๐ธjustifyโ justifies the current paragraph (or the marked region). A "paragraph," for the record, is a group of contiguous lines that all share the same indentation โ apart from possibly the first line. The beginning of a paragraph is detected either by that lone line with a differing indentation, or by a preceding blank line. Vibe-based line detection, honestly. ๐fulljustifyโ justifies the entire current buffer (or the marked region). Go big or go home. โญindentโ indents (shifts to the right) the current line or the marked lines.unindentโ unindents (shifts to the left) the current line or the marked lines.commentโ comments or uncomments the current line or the marked lines, using the comment style specified in the active syntax. โ๏ธcompleteโ completes the fragment before the cursor into a full word, when possible, by finding that word elsewhere in the current buffer.leftโ goes left one position (in the editor or browser). โฌ ๏ธrightโ goes right one position (in the editor or browser). โก๏ธupโ goes one line up (in the editor or browser). โฌ๏ธdownโ goes one line down (in the editor or browser). โฌ๏ธscrollleftโ scrolls the viewport atabsizeto the left, when possible. (This function is bound by default toM-<.)scrollrightโ scrolls the viewport atabsizeto the right. When it's needed to keep the cursor visible, the cursor gets moved to a longer line in the viewport. If there is no sufficiently longer line, no scroll happens at all. (This function is bound by default toM->.)scrollupโ scrolls the viewport up one row (meaning the text slides down) while keeping the cursor in the same text position, if possible. (This function is bound by default toM-Up. And ifM-Updoes absolutely nothing on your Linux console, go read the FAQ:https://nano-editor.org/dist/latest/faq.html#4.1.)scrolldownโ scrolls the viewport down one row (meaning the text slides up) while keeping the cursor in the same text position, if possible. (This function is bound by default toM-Down.)centerโ scrolls the line with the cursor to the middle of the viewport. Main character placement. ๐cycleโ scrolls the line with the cursor first to the middle of the viewport, then to the top, then to the bottom. A little tour. ๐prevwordโ moves the cursor to the beginning of the previous word.nextwordโ moves the cursor to the beginning of the next word.homeโ moves the cursor to the beginning of the current line.endโ moves the cursor to the end of the current line.beginparaโ moves the cursor to the beginning of the current paragraph.endparaโ moves the cursor to the end of the current paragraph.prevblockโ moves the cursor to the beginning of the current or the preceding block of text. (Blocks are separated by one or more blank lines.) ๐งฑnextblockโ moves the cursor to the beginning of the next block of text.toprowโ moves the cursor to the first row in the viewport.bottomrowโ moves the cursor to the last row in the viewport.pageupโ goes up one screenful.pagedownโ goes down one screenful.firstlineโ goes to the first line of the file.lastlineโ goes to the last line of the file.gotolineโ goes to a specific line (and column, if you give one). A negative number counts from the end of the buffer (and the end of the line). Putting++or--before the first number will jump the given number of lines forward or backward. Teleportation but the destination math is left as an exercise. ๐findbracketโ moves the cursor to the bracket (or brace, or parenthesis, etc.) that matches โ i.e. pairs with โ the one under the cursor. Seeset matchbrackets. ๐anchorโ places an anchor at the current line, or removes it when it's already there. (An anchor is visible when line numbers are activated.) โprevanchorโ goes to the first anchor before the current line.nextanchorโ goes to the first anchor after the current line.prevbufโ switches to editing/viewing the previous buffer when multiple buffers are open.nextbufโ switches to editing/viewing the next buffer when multiple buffers are open.verbatimโ inserts the next keystroke verbatim into the file, or begins Unicode input when a hexadecimal digit is typed.tabโ inserts a tab at the current cursor location.enterโ inserts a new line below the current one.deleteโ deletes the character under the cursor.backspaceโ deletes the character before the cursor.recordmacroโ starts recording your keystrokes โ they get stored as a macro. When you're already recording, calling it again stops the recording. ๐ฅrunmacroโ replays the keystrokes of the last recorded macro.undoโ undoes the last performed text action (adding text, deleting text, etc.). Your safety net, bestie. ๐ญredoโ redoes the last undone action (that is: it undoes an undo). Yes, we're doing undo-ception. ๐ซrefreshโ refreshes the screen.suspendโ suspends the editor and hands control back to the shell (until you tell the process to resume execution withfg). Not me abandoning nano mid-sentence. ๐casesensโ toggles whether searching/replacing ignores or respects the case of the given characters.regexpโ toggles whether searching/replacing uses literal strings or regular expressions. Choose your fighter. โ๏ธbackwardsโ toggles whether searching/replacing goes forward or backward.olderโ retrieves the previous (earlier) entry at a prompt.newerโ retrieves the next (later) entry at a prompt.flipreplaceโ toggles between searching for something and replacing something.flipexecuteโ switches from inserting a file to executing a command.flippipeโ when executing a command, toggles whether the current buffer (or the marked region) is piped to the command.flipnewbufferโ when reading in a file or executing a command, toggles between inserting the result into the current buffer and inserting it into a new empty buffer.flipconvertโ when reading in a file, toggles between converting it from DOS format and not converting it. Converting is the default.dosformatโ when writing a file, switches to writing DOS format (CR+LF line endings). Classic, iconic, a little cursed. ๐appendโ when writing a file, appends to the end instead of overwriting.prependโ when writing a file, "prepends" (writes at the beginning) instead of overwriting.backupโ when writing a file, creates a backup of the current file. ๐discardbufferโ discards the current buffer without saving (this one lives in the Write Out menu). When it was the last buffer, then nano exits with error status2.
โ ๏ธ Yeah โ that exit status 2 is doing exactly what it says. Discarding unsaved work is permanent. Say it with me: save first, vibe second.
browserโ starts the file browser (in the Read File and Write Out menus), letting you select a file from a list. ๐gotodirโ goes to a directory that you specify, letting you browse anywhere in the filesystem.firstfileโ goes to the first file in the list when you're using the file browser.lastfileโ goes to the last file in the list when you're using the file browser.nohelpโ toggles the presence of the two-line list of key bindings at the bottom of the screen. Heads up, this toggle is special: it is available in all menus except the help viewer and the linter. All further toggles are available in the main menu only. ๐zeroโ toggles the presence of the title bar and the status bar.constantshowโ toggles the constant reporting (on the status bar) of the current line, column, and character positions.softwrapโ toggles the displaying of overlong lines on multiple screen lines.linenumbersโ toggles the display of line numbers in front of the text. ๐ขwhitespacedisplayโ toggles the showing of whitespace.nosyntaxโ flips syntax highlighting on and off, like a little lightswitch for the colors โจsmarthomeโ toggles how smart your Home key is being ๐autoindentโ toggles whether a brand-new line inherits the same amount of leading whitespace as the line above it โ or, if that previous line is the start of a paragraph, then it copies the next line instead ๐ซถcutfromcursorโ toggles whether cutting takes the whole entire line, or only from wherever your cursor is sitting to the end of the line โ๏ธbreaklonglinesโ toggles whether the part of a line that goes too long gets hard-wrapped down onto the next line ๐ธtabstospacesโ toggles whether the tabs you type get converted into spaces ๐mouseโ toggles mouse support ๐ฑ๏ธ (well, ๐ญ energy)
๐ the menu sections, the whole squad ๐
Valid menu sections are, bestie:
mainโ the main editor window, the place where you actually type and edit your text. main character energy, literally ๐ซถhelpโ the menu for the help viewer ๐searchโ the search menu (AKAwhereis) ๐replaceโ the 'search to replace' menu ๐replacewithโ the 'replace with' menu, which pops up after 'search to replace' โจyesnoโ the 'yesno' menu, where the Yes/No/All/Cancel question gets asked ๐gotolineโ the 'goto line (and column)' menu ๐ฏwriteoutโ the 'write file' menu ๐พinsertโ the 'insert file' menu ๐ฅbrowserโ the 'file browser' menu, for picking a file to be opened, inserted, or written to ๐๏ธwhereisfileโ the 'search for a file' menu inside the file browser ๐gotodirโ the 'go to directory' menu inside the file browser ๐โโ๏ธexecuteโ the menu for inserting the output of an external command, or for filtering the buffer (or the marked region) through an external command, or for running one of several tools ๐ ๏ธspellโ the menu of the integrated spell checker, where you can edit a misspelled word ๐linterโ the linter menu, which lets you hop through the linting messages ๐allโ a special name that scoops up every menu. Forbindit means all the menus where the function you named actually exists; forunbindit means all the menus where the key you named exists. iconic behavior, no notes ๐
๐ EXAMPLES ๐
Wanna make Ctrl+Z suspend nano? Say less:
bind ^Z suspend main
Wanna make Shift+Alt+C copy the marked region straight to the system's clipboard? Obsessed, here:
bind Sh-M-C "{execute}| xsel -ib {enter}{undo}" main
๐ FILES ๐
/etc/nanorcโ the system-wide configuration file ๐~/.nanorcor$XDG_CONFIG_HOME/nano/nanorcor~/.config/nano/nanorcโ the per-user configuration file, aka your personal little corner ๐/usr/share/nano/*โ syntax definitions for the syntax coloring of common file types (and for the less common file types over in theextra/subdirectory) ๐ธ
๐ SEE ALSO ๐
nano(1)https://nano-editor.org/cheatsheet.htmlโ an overview of the default key bindings, aka your cheat sheet bestie ๐ซถ
and that's the whole page, bestie!! you made it to the end, ate and left no crumbs ๐
โจ this was GNU nano 9.3, dated October 2026, and it's the NANORC(5) manual page. go forth and <rainbow>configure your little heart out ๐ฆ๐๐
๐ฆ where this page comes from
- alpine 3.24: nano-doc 9.3-r0 ยท GPL-3.0-or-later
- arch rolling: nano 9.3-1 ยท GPL-3.0-or-later
- nixpkgs unstable: nano 9.3
- Copyright (C) 2003-2011, 2013-2026 Free Software Foundation, Inc
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms