| 1 |
.\" Copyright (C) 2003-2011, 2013-2026 Free Software Foundation, Inc. |
| 2 |
.\" |
| 3 |
.\" This document is dual-licensed. You may distribute and/or modify it |
| 4 |
.\" under the terms of either of the following licenses: |
| 5 |
.\" |
| 6 |
.\" * The GNU General Public License, as published by the Free Software |
| 7 |
.\" Foundation, version 3 or (at your option) any later version. You |
| 8 |
.\" should have received a copy of the GNU General Public License |
| 9 |
.\" along with this program. If not, see |
| 10 |
.\" <https://www.gnu.org/licenses/>. |
| 11 |
.\" |
| 12 |
.\" * The GNU Free Documentation License, as published by the Free |
| 13 |
.\" Software Foundation, version 1.2 or (at your option) any later |
| 14 |
.\" version, with no Invariant Sections, no Front-Cover Texts, and no |
| 15 |
.\" Back-Cover Texts. You should have received a copy of the GNU Free |
| 16 |
.\" Documentation License along with this program. If not, see |
| 17 |
.\" <https://www.gnu.org/licenses/>. |
| 18 |
.\" |
| 19 |
.TH NANORC 5 "version 9.0" "April 2026" |
| 20 |
|
| 21 |
.SH NAME |
| 22 |
nanorc \- GNU nano's configuration file |
| 23 |
|
| 24 |
.SH DESCRIPTION |
| 25 |
The \fInanorc\fR files contain the default settings for \fBnano\fR, |
| 26 |
a small and friendly text editor. During startup, if \fB\-\-rcfile\fR |
| 27 |
is not given, \fBnano\fR reads two files: first the system-wide settings, |
| 28 |
from \fI/etc/nanorc\fR (the exact path might be different on your system), |
| 29 |
and then the user-specific settings, either from \fI~/.nanorc\fR or from |
| 30 |
\fI$XDG_CONFIG_HOME/nano/nanorc\fR or from \fI~/.config/nano/nanorc\fR, |
| 31 |
whichever is encountered first. If \fB\-\-rcfile\fR is given, |
| 32 |
\fBnano\fR reads just the specified settings file. |
| 33 |
|
| 34 |
.SH NOTICES |
| 35 |
Since version 9.0, all lines are scrolled horizontally together |
| 36 |
(when the cursor approaches the edge), by just the amount needed, |
| 37 |
instead of scrolling only the current line by a large step. |
| 38 |
If you prefer the old behavior, you can use \fB--solo\fR on the |
| 39 |
command line or \fBset solosidescroll\fR in your \fInanorc\fR. |
| 40 |
.sp |
| 41 |
Also since version 9.0, keystrokes \fBM-<\fR and \fBM->\fR have |
| 42 |
been reassigned to the `scrollleft` and `scrollright` functions. |
| 43 |
If you want those keystrokes to do what they did before version 9.0, |
| 44 |
add these two lines at the end of your \fInanorc\fR file: |
| 45 |
.sp |
| 46 |
.RS 4 |
| 47 |
.B bind M\-< prevbuf main |
| 48 |
.br |
| 49 |
.B bind M\-> nextbuf main |
| 50 |
.RE |
| 51 |
.sp |
| 52 |
Since version 8.0, to be newcomer friendly, \fB^F\fR starts a forward search, |
| 53 |
\fB^B\fR starts a backward search, \fBM\-F\fR searches the next occurrence |
| 54 |
forward, and \fBM\-B\fR searches the next occurrence backward. If you want |
| 55 |
those keystrokes to do what they did before version 8.0, add the following |
| 56 |
four lines at the end of your \fInanorc\fR file: |
| 57 |
.sp |
| 58 |
.RS 4 |
| 59 |
.B bind ^F forward main |
| 60 |
.br |
| 61 |
.B bind ^B back main |
| 62 |
.br |
| 63 |
.B bind M\-F formatter main |
| 64 |
.br |
| 65 |
.B bind M\-B linter main |
| 66 |
.RE |
| 67 |
.sp |
| 68 |
|
| 69 |
.\" Never hyphenate these: |
| 70 |
.hw ncurses terminfo |
| 71 |
|
| 72 |
.SH OPTIONS |
| 73 |
The configuration file accepts a series of \fBset\fR and \fBunset\fR |
| 74 |
commands, which can be used to configure nano on startup without using |
| 75 |
command-line options. Additionally, there are some commands to define |
| 76 |
syntax highlighting and to rebind keys \(em see the two separate sections |
| 77 |
on those. \fBnano\fR reads one command per line. |
| 78 |
All commands and keywords should be written in lowercase. |
| 79 |
.sp |
| 80 |
Options in \fInanorc\fR files take precedence over nano's defaults, and |
| 81 |
command-line options override \fInanorc\fR settings. Also, options that |
| 82 |
do not take an argument are unset by default. So using the \fBunset\fR |
| 83 |
command is only needed when wanting to override a setting of the system's |
| 84 |
\fInanorc\fR file in your own \fInanorc\fR. Options that take an |
| 85 |
argument cannot be unset. |
| 86 |
.sp |
| 87 |
Quotes inside the \fIcharacters\fR parameters below should not be escaped. |
| 88 |
The last double quote on the line will be seen as the closing quote. |
| 89 |
.sp |
| 90 |
The supported commands and arguments are: |
| 91 |
.TP 3 |
| 92 |
.B set afterends |
| 93 |
Make Ctrl+Right and Ctrl+Delete stop at word ends instead of beginnings. |
| 94 |
.TP |
| 95 |
.B set allow_insecure_backup |
| 96 |
When backing up files, allow the backup to succeed even if its permissions |
| 97 |
can't be (re)set due to special OS considerations. You should |
| 98 |
NOT enable this option unless you are sure you need it. |
| 99 |
.TP |
| 100 |
.B set atblanks |
| 101 |
When soft line wrapping is enabled, make it wrap lines at blank characters |
| 102 |
(tabs and spaces) instead of always at the edge of the screen. |
| 103 |
.TP |
| 104 |
.B set autoindent |
| 105 |
Automatically indent a newly created line to the same number of tabs |
| 106 |
and/or spaces as the previous line (or as the next line if the previous |
| 107 |
line is the beginning of a paragraph). |
| 108 |
.TP |
| 109 |
.B set backup |
| 110 |
When saving a file, create a backup file by adding a tilde (\fB~\fR) to |
| 111 |
the file's name. |
| 112 |
.TP |
| 113 |
.B set backupdir \fIdirectory\fR |
| 114 |
Make and keep not just one backup file, but make and keep a uniquely |
| 115 |
numbered one every time a file is saved \(em when backups are enabled |
| 116 |
with \fBset backup\fR or \fB\-\-backup\fR or \fB\-B\fR. |
| 117 |
The uniquely numbered files are stored in the specified \fIdirectory\fR. |
| 118 |
.TP |
| 119 |
.B set boldtext |
| 120 |
Use bold instead of reverse video for the title bar, status bar, |
| 121 |
prompt bar, mini bar, key combos, line numbers, and selected text. |
| 122 |
This can be overridden by setting the options \fB\%titlecolor\fR, |
| 123 |
\fB\%statuscolor\fR, \fB\%promptcolor\fR, \fB\%minicolor\fR, |
| 124 |
\fB\%keycolor\fR, \fB\%numbercolor\fR, and/or \fB\%selectedcolor\fR. |
| 125 |
.TP |
| 126 |
.B set bookstyle |
| 127 |
When justifying, treat any line that starts with whitespace as the |
| 128 |
beginning of a paragraph (unless auto-indenting is on). |
| 129 |
.TP |
| 130 |
.BI "set brackets """ characters """" |
| 131 |
Set the characters treated as closing brackets when justifying |
| 132 |
paragraphs. This may not include blank characters. Only closing |
| 133 |
punctuation (see \fBset punct\fR), optionally followed by the specified |
| 134 |
closing brackets, can end sentences. The default value is "\fB\(dq')>]}\fR". |
| 135 |
.TP |
| 136 |
.B set breaklonglines |
| 137 |
Automatically hard-wrap the current line when it becomes overlong \(em |
| 138 |
that is: when it becomes wider than the value given with \fBset fill\fR |
| 139 |
(which defaults to the width of the terminal minus eight). |
| 140 |
.TP |
| 141 |
.B set casesensitive |
| 142 |
Do case-sensitive searches by default. |
| 143 |
.TP |
| 144 |
.B set colonparsing |
| 145 |
When a filename given on the command line ends in a colon plus digits |
| 146 |
and this filename does not exist, then snip the colon plus digits and |
| 147 |
understand the digits as a line number. If the trimmed filename does |
| 148 |
not exist either, then repeat the process and understand the obtained |
| 149 |
two numbers as line and column number. But if the doubly trimmed |
| 150 |
filename does not exist either, then forget the trimming and accept |
| 151 |
the original filename as is. To disable this colon parsing for some |
| 152 |
file, use \fB+1\fR or similar before the relevant filename. |
| 153 |
.TP |
| 154 |
.B set constantshow |
| 155 |
Constantly report the cursor position on the status bar. |
| 156 |
This overrides the option \fBquickblank\fR. |
| 157 |
.TP |
| 158 |
.B set cutfromcursor |
| 159 |
Use cut-from-cursor-to-end-of-line by default, instead of cutting the whole line. |
| 160 |
.TP |
| 161 |
.B set emptyline |
| 162 |
Do not use the line below the title bar, leaving it entirely blank. |
| 163 |
.TP |
| 164 |
.B set errorcolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR |
| 165 |
Use this color combination for the status bar when an error message is displayed. |
| 166 |
The default value is \fBbold,white,red\fR. |
| 167 |
See \fBset \%titlecolor\fR for valid color names. |
| 168 |
.TP |
| 169 |
.B set fill \fInumber\fR |
| 170 |
Set the target width for justifying and automatic hard-wrapping at this |
| 171 |
\fInumber\fR of columns. If the value is 0 or less, wrapping occurs |
| 172 |
at the width of the screen minus \fInumber\fR columns, allowing the wrap |
| 173 |
point to vary along with the width of the screen if the screen is resized. |
| 174 |
The default value is \fB\-8\fR. |
| 175 |
.TP |
| 176 |
.B set functioncolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR |
| 177 |
Use this color combination for the concise function descriptions |
| 178 |
in the two help lines at the bottom of the screen. |
| 179 |
See \fBset \%titlecolor\fR for more details. |
| 180 |
.TP |
| 181 |
.B set guidestripe \fInumber |
| 182 |
Draw a vertical stripe at the given column, to help judge the width of the |
| 183 |
text. (The color of the stripe can be changed with \fBset stripecolor\fR.) |
| 184 |
.TP |
| 185 |
.B set historylog |
| 186 |
Save the last hundred search strings and replacement strings and |
| 187 |
executed commands, so they can be easily reused in later sessions. |
| 188 |
.TP |
| 189 |
.B set indicator |
| 190 |
Display a "scrollbar" on the righthand side of the edit window. |
| 191 |
It shows the position of the viewport in the buffer |
| 192 |
and how much of the buffer is covered by the viewport. |
| 193 |
.TP |
| 194 |
.B set jumpyscrolling |
| 195 |
Scroll the buffer contents per half-screen instead of per line. |
| 196 |
.TP |
| 197 |
.B set keycolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR |
| 198 |
Use this color combination for the shortcut key combos |
| 199 |
in the two help lines at the bottom of the screen. |
| 200 |
See \fBset \%titlecolor\fR for more details. |
| 201 |
.TP |
| 202 |
.B set linenumbers |
| 203 |
Display line numbers to the left of the text area. |
| 204 |
(Any line with an anchor additionally gets a mark in the margin.) |
| 205 |
.TP |
| 206 |
.B set locking |
| 207 |
Enable vim-style lock-files for when editing files. |
| 208 |
.TP |
| 209 |
.B set magic |
| 210 |
When neither the file's name nor its first line give a clue, |
| 211 |
try using libmagic to determine the applicable syntax. |
| 212 |
(Calling libmagic can be relatively time consuming. |
| 213 |
It is therefore not done by default.) |
| 214 |
.TP |
| 215 |
.BI "set matchbrackets """ characters """" |
| 216 |
Specify the opening and closing brackets that can be found by bracket |
| 217 |
searches. This may not include blank characters. The opening set must |
| 218 |
come before the closing set, and the two sets must be in the same order. |
| 219 |
The default value is "\fB(<[{)>]}\fR". |
| 220 |
.TP |
| 221 |
.B set minibar |
| 222 |
Suppress the title bar and instead show information about |
| 223 |
the current buffer at the bottom of the screen, in the space |
| 224 |
for the status bar. In this "mini bar" the filename is shown |
| 225 |
on the left, followed by an asterisk if the buffer has been modified. |
| 226 |
On the right are displayed the current line and column number, the |
| 227 |
code of the character under the cursor (in Unicode format: U+xxxx), |
| 228 |
the same flags as are shown by \fBset stateflags\fR, and a percentage |
| 229 |
that expresses how far the cursor is into the file (linewise). |
| 230 |
When a file is loaded or saved, and also when switching between buffers, |
| 231 |
the number of lines in the buffer is displayed after the filename. |
| 232 |
This number is cleared upon the next keystroke, or replaced with an |
| 233 |
[i/n] counter when multiple buffers are open. |
| 234 |
The line plus column numbers and the character code are displayed only when |
| 235 |
\fBset constantshow\fR is used, and can be toggled on and off with \fBM\-C\fR. |
| 236 |
The state flags are displayed only when \fBset stateflags\fR is used. |
| 237 |
.TP |
| 238 |
.B set minicolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR |
| 239 |
Use this color combination for the mini bar. |
| 240 |
(When this option is not specified, the colors of the title bar are used.) |
| 241 |
See \fBset \%titlecolor\fR for more details. |
| 242 |
.TP |
| 243 |
.B set mouse |
| 244 |
Enable mouse support, if available for your system. When enabled, |
| 245 |
mouse clicks can be used to place the cursor, set the mark (with two |
| 246 |
clicks), and execute shortcuts. The mouse works in the X Window |
| 247 |
System, and on the console when gpm is running. Text can still be |
| 248 |
selected through dragging by holding down the Shift key. |
| 249 |
.TP |
| 250 |
.B set multibuffer |
| 251 |
When reading in a file with \fB^R\fR, insert it into a new buffer by default. |
| 252 |
.TP |
| 253 |
.B set noconvert |
| 254 |
Don't convert files from DOS/Mac format. |
| 255 |
.TP |
| 256 |
.B set nohelp |
| 257 |
Don't display the two help lines at the bottom of the screen. |
| 258 |
.TP |
| 259 |
.B set nonewlines |
| 260 |
Don't automatically add a newline when a text does not end with one. |
| 261 |
(This can cause you to save non-POSIX text files.) |
| 262 |
.TP |
| 263 |
.B set nowrap |
| 264 |
Deprecated option since it has become the default setting. |
| 265 |
When needed, use \fBunset breaklonglines\fR instead. |
| 266 |
.TP |
| 267 |
.B set numbercolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR |
| 268 |
Use this color combination for line numbers. |
| 269 |
See \fBset \%titlecolor\fR for more details. |
| 270 |
.TP |
| 271 |
.B set operatingdir \fIdirectory\fR |
| 272 |
At startup, make \fBnano\fR change to the given \fIdirectory\fR, and allow |
| 273 |
reading and writing files only in this directory and its subdirectories. |
| 274 |
.TP |
| 275 |
.B set positionlog |
| 276 |
Save the positions of cursor and anchors between editing sessions. |
| 277 |
These positions are remembered for the 200 most-recently edited files. |
| 278 |
.TP |
| 279 |
.B set preserve |
| 280 |
Preserve the XOFF and XON sequences (\fB^S\fR and \fB^Q\fR) so that |
| 281 |
they are caught by the terminal (stopping and resuming the output). |
| 282 |
.TP |
| 283 |
.B set promptcolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR |
| 284 |
Use this color combination for the prompt bar. |
| 285 |
(When this option is not specified, the colors of the title bar are used.) |
| 286 |
See \fBset \%titlecolor\fR for more details. |
| 287 |
.TP |
| 288 |
.BI "set punct """ characters """" |
| 289 |
Set the characters treated as closing punctuation when justifying |
| 290 |
paragraphs. This may not include blank characters. Only the |
| 291 |
specified closing punctuation, optionally followed by closing brackets |
| 292 |
(see \fBset brackets\fR), can end sentences. The default value is "\fB!.?\fR". |
| 293 |
.TP |
| 294 |
.B set quickblank |
| 295 |
Make status-bar messages disappear after 1 keystroke instead of after 20. |
| 296 |
Note that option \fBconstantshow\fR overrides this. |
| 297 |
When option \fBminibar\fR or \fBzero\fR is in effect, |
| 298 |
\fBquickblank\fR makes a message disappear after |
| 299 |
0.8 seconds instead of after the default 1.5 seconds. |
| 300 |
.TP |
| 301 |
.BI "set quotestr """ regex """" |
| 302 |
Set the regular expression for matching the quoting part of a line. |
| 303 |
The default value is "\fB^([\ \et]*([!#%:;>|}]|//))+\fR". |
| 304 |
(Note that \fB\et\fR stands for an actual Tab character.) |
| 305 |
This makes it possible to rejustify blocks of quoted text when composing |
| 306 |
email, and to rewrap blocks of line comments when writing source code. |
| 307 |
.TP |
| 308 |
.B set rawsequences |
| 309 |
Interpret escape sequences directly, instead of asking \fBncurses\fR |
| 310 |
to translate them. (If you need this option to get some keys to work |
| 311 |
properly, it means that the \fBterminfo\fR terminal description that is used |
| 312 |
does not fully match the actual behavior of your terminal. This can |
| 313 |
happen when you ssh into a BSD machine, for example.) |
| 314 |
Using this option disables \fBnano\fR's mouse support. |
| 315 |
.TP |
| 316 |
.B set rebinddelete |
| 317 |
Interpret the Delete and Backspace keys differently so that both Backspace |
| 318 |
and Delete work properly. You should only use this option when on your |
| 319 |
system either Backspace acts like Delete or Delete acts like Backspace. |
| 320 |
.TP |
| 321 |
.B set regexp |
| 322 |
Do regular-expression searches by default. |
| 323 |
Regular expressions in \fBnano\fR are of the extended type (ERE). |
| 324 |
.TP |
| 325 |
.B set saveonexit |
| 326 |
Save a changed buffer automatically on exit (\fB^X\fR); don't prompt. |
| 327 |
.TP |
| 328 |
.B set scrollercolor \fIfgcolor\fB,\fIbgcolor\fR |
| 329 |
Use this color combination for the indicator alias "scrollbar". |
| 330 |
See \fBset \%titlecolor\fR for more details. |
| 331 |
.TP |
| 332 |
.B set selectedcolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR |
| 333 |
Use this color combination for selected text. |
| 334 |
See \fBset \%titlecolor\fR for more details. |
| 335 |
.TP |
| 336 |
.B set showcursor |
| 337 |
Put the cursor on the highlighted item in the file browser, and show |
| 338 |
the cursor in the help viewer, to aid braille users and people with |
| 339 |
poor vision. |
| 340 |
.TP |
| 341 |
.B set smarthome |
| 342 |
Make the Home key smarter. When Home is pressed anywhere but at the |
| 343 |
very beginning of non-whitespace characters on a line, the cursor jumps |
| 344 |
to that beginning (either forwards or backwards). If the cursor is |
| 345 |
already at that position, it jumps to the true beginning of the line. |
| 346 |
.TP |
| 347 |
.B set softwrap |
| 348 |
Display lines that exceed the screen's width over multiple screen lines. |
| 349 |
(You can make this soft-wrapping occur at whitespace instead of rudely at |
| 350 |
the screen's edge, by using also \fBset atblanks\fR.) |
| 351 |
.TP |
| 352 |
.B set solosidescroll |
| 353 |
When the cursor approaches the right edge of the edit window, scroll only the |
| 354 |
current line sideways by a large amount, instead of scrolling all visible lines |
| 355 |
sideways by just the amount needed to keep the cursor in view. |
| 356 |
This latter whole-window smooth sideways scrolling is the new default behavior. |
| 357 |
The single-line jerky sideways scrolling enabled by this option was the old |
| 358 |
behavior \(em the only behavior that \fBnano\fR knew. |
| 359 |
.TP |
| 360 |
.B set speller """\fIprogram\fR [\fIargument \fR...]\fB""" |
| 361 |
Use the given \fIprogram\fR to do spell checking and correcting, instead of |
| 362 |
using the built-in corrector that calls \fBhunspell\fR(1) or \fBspell\fR(1). |
| 363 |
.TP |
| 364 |
.B set spotlightcolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR |
| 365 |
Use this color combination for highlighting a search match. |
| 366 |
The default value is \fBblack,\%lightyellow\fR. |
| 367 |
See \fBset \%titlecolor\fR for valid color names. |
| 368 |
.TP |
| 369 |
.B set stateflags |
| 370 |
Use the top-right corner of the screen for showing some state flags: |
| 371 |
\fBI\fR when auto-indenting, \fBM\fR when the mark is on, \fBL\fR when |
| 372 |
hard-wrapping (breaking long lines), \fBR\fR when recording a macro, |
| 373 |
and \fBS\fR when soft-wrapping. |
| 374 |
When the buffer is modified, a star (\fB*\fR) is shown after the |
| 375 |
filename in the center of the title bar. |
| 376 |
.TP |
| 377 |
.B set statuscolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR |
| 378 |
Use this color combination for the status bar. |
| 379 |
See \fBset \%titlecolor\fR for more details. |
| 380 |
.TP |
| 381 |
.B set stripecolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR |
| 382 |
Use this color combination for the vertical guiding stripe. |
| 383 |
See \fBset \%titlecolor\fR for more details. |
| 384 |
.TP |
| 385 |
.B set tabsize \fInumber\fR |
| 386 |
Use a tab size of \fInumber\fR columns. The value of \fInumber\fR must be |
| 387 |
greater than 0. The default value is \fB8\fR. |
| 388 |
.TP |
| 389 |
.B set tabstospaces |
| 390 |
Convert each typed tab to spaces \(em to the number of spaces |
| 391 |
that a tab at that position would take up. |
| 392 |
(Note: pasted tabs are not converted.) |
| 393 |
.TP |
| 394 |
.B set titlecolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR |
| 395 |
Use this color combination for the title bar. |
| 396 |
Valid names for the foreground and background colors are: |
| 397 |
.BR red ", " green ", " blue ", " \%magenta ", " \%yellow ", " \%cyan , |
| 398 |
.BR white ", and " black . |
| 399 |
Each of these eight names may be prefixed with the word \fBlight\fR |
| 400 |
to get a brighter version of that color. |
| 401 |
The word \fBgrey\fR or \fBgray\fR may be used |
| 402 |
as a synonym for \fB\%lightblack\fR. |
| 403 |
On a Linux console, \fBlight\fR does not have |
| 404 |
any effect for a background color. |
| 405 |
On terminal emulators that can do at least 256 colors, |
| 406 |
other valid (but unprefixable) color names are: |
| 407 |
.BR pink ", " \%purple ", " mauve ", " \%lagoon ", " mint ", " lime ", " peach , |
| 408 |
.BR \%orange ", " \%latte ", " \%rosy ", " beet ", " plum ", " sea ", " sky , |
| 409 |
.BR slate ", " teal ", " sage ", " brown ", " \%ocher ", " sand ", " \%tawny , |
| 410 |
.BR brick ", " \%crimson ", and " \%normal |
| 411 |
\(em where \fB\%normal\fR means the default foreground or background color. |
| 412 |
On such emulators, the color may also be specified as a three-digit hexadecimal |
| 413 |
number prefixed with \fB#\fR, with the digits representing the amounts of red, |
| 414 |
green, and blue, respectively. This tells \fBnano\fR to select from the |
| 415 |
available palette the color that approximates the given values. |
| 416 |
|
| 417 |
Either "\fIfgcolor\fR" or "\fB,\fIbgcolor\fR" may be left out, |
| 418 |
and the pair may be preceded by \fBbold\fR and/or \fB\%italic\fR |
| 419 |
(separated by commas) to get a bold and/or slanting typeface, |
| 420 |
if your terminal can do those. |
| 421 |
.TP |
| 422 |
.B set trimblanks |
| 423 |
Remove trailing whitespace from wrapped lines when automatic |
| 424 |
hard-wrapping occurs or when text is justified. |
| 425 |
.TP |
| 426 |
.B set unix |
| 427 |
Save a file by default in Unix format. This overrides nano's |
| 428 |
default behavior of saving a file in the format that it had. |
| 429 |
(This option has no effect when you also use \fBset noconvert\fR.) |
| 430 |
.TP |
| 431 |
.BI "set whitespace """ characters """" |
| 432 |
Set the two characters used to indicate the presence of tabs and |
| 433 |
spaces. They must be single-column characters. The default pair |
| 434 |
for a UTF-8 locale is "\fB\[Fc]\[md]\fR", and for other locales "\fB>.\fR". |
| 435 |
.TP |
| 436 |
.B set wordbounds |
| 437 |
Detect word boundaries differently by treating punctuation |
| 438 |
characters as parts of words. |
| 439 |
.TP |
| 440 |
.BI "set wordchars """ characters """" |
| 441 |
Specify which other characters (besides the normal alphanumeric ones) |
| 442 |
should be considered as parts of words. When using this option, you |
| 443 |
probably want to unset \fBwordbounds\fR. |
| 444 |
.TP |
| 445 |
.B set zap |
| 446 |
Let an unmodified Backspace or Delete erase the marked region |
| 447 |
(instead of a single character, and without affecting the cutbuffer). |
| 448 |
.TP |
| 449 |
.B set zero |
| 450 |
Hide all elements of the interface (title bar, status bar, and help lines) |
| 451 |
and use all rows of the terminal for showing the contents of the buffer. |
| 452 |
The status bar appears only when there is a significant message, |
| 453 |
and disappears after 1.5 seconds or upon the next keystroke. |
| 454 |
With \fBM\-Z\fR the title bar plus status bar can be toggled. |
| 455 |
With \fBM\-X\fR the help lines. |
| 456 |
|
| 457 |
.SH SYNTAX HIGHLIGHTING |
| 458 |
Coloring the different syntactic elements of a file |
| 459 |
is done via regular expressions (see the \fBcolor\fR command below). |
| 460 |
This is inherently imperfect, because regular expressions are not |
| 461 |
powerful enough to fully parse a file. Nevertheless, regular |
| 462 |
expressions can do a lot and are easy to make, so they are a |
| 463 |
good fit for a small editor like \fBnano\fR. |
| 464 |
.sp |
| 465 |
All regular expressions in \fBnano\fR are POSIX extended regular expressions. |
| 466 |
This means that \fB.\fR, \fB?\fR, \fB*\fR, \fB+\fR, \fB^\fR, \fB$\fR, and |
| 467 |
several other characters are special. |
| 468 |
The period \fB.\fR matches any single character, |
| 469 |
\fB?\fR means the preceding item is optional, |
| 470 |
\fB*\fR means the preceding item may be matched zero or more times, |
| 471 |
\fB+\fR means the preceding item must be matched one or more times, |
| 472 |
\fB^\fR matches the beginning of a line, and \fB$\fR the end, |
| 473 |
\fB\e<\fR matches the start of a word, and \fB\e>\fR the end, |
| 474 |
and \fB\es\fR matches a blank. |
| 475 |
It also means that lookahead and lookbehind are not possible. |
| 476 |
A complete explanation can be found in the manual page of GNU grep: |
| 477 |
\fBman grep\fR. |
| 478 |
.sp |
| 479 |
Each regular expression in a \fBnanorc\fR file should be wrapped in |
| 480 |
double quotes (\fB""\fR). Multiple regular expressions can follow |
| 481 |
each other on a line by separating them with blanks. This means that |
| 482 |
a regular expression cannot contain a double quote followed by a blank. |
| 483 |
When you need this combination inside a regular expression, |
| 484 |
then either the double quote or the blank should be put |
| 485 |
between square brackets (\fB[]\fR). |
| 486 |
.sp |
| 487 |
For each kind of file a separate syntax can be defined |
| 488 |
via the following commands: |
| 489 |
.TP |
| 490 |
.BI syntax " name \fR[" """" fileregex """ " \fR...] |
| 491 |
Start the definition of a syntax with this \fIname\fR. |
| 492 |
All subsequent \fBcolor\fR and other such commands |
| 493 |
are added to this syntax, until a new \fBsyntax\fR |
| 494 |
command is encountered. |
| 495 |
.sp |
| 496 |
When \fBnano\fR is run, this syntax is automatically |
| 497 |
activated (for the relevant buffer) if the absolute filename |
| 498 |
matches the extended regular expression \fIfileregex\fR. |
| 499 |
Or the syntax can be explicitly activated (for all buffers) |
| 500 |
by using the \fB\-Y\fR or \fB\-\-syntax\fR |
| 501 |
command-line option followed by the \fIname\fR. |
| 502 |
.sp |
| 503 |
The syntax \fBdefault\fR is special: it takes no \fIfileregex\fR, |
| 504 |
and applies to files that don't match any syntax's regexes. |
| 505 |
The syntax \fBnone\fR is reserved; specifying it on the command line |
| 506 |
is the same as not having a syntax at all. |
| 507 |
.TP |
| 508 |
.BI "header """ regex """ " \fR... |
| 509 |
If from all defined syntaxes no \fIfileregex\fR matched, then compare |
| 510 |
this \fIregex\fR (or regexes) against the first line of the current file, |
| 511 |
to determine whether this syntax should be used for it. |
| 512 |
.TP |
| 513 |
.BI "magic """ regex """ " \fR... |
| 514 |
If no \fIfileregex\fR matched and no \fBheader\fR regex matched |
| 515 |
either, then compare this \fIregex\fR (or regexes) against the |
| 516 |
result of querying the \fBmagic\fR database about the current |
| 517 |
file, to determine whether this syntax should be used for it. |
| 518 |
(This querying is done only when \fBlibmagic\fR is actually installed |
| 519 |
on the system and \fB\-\-magic\fR or \fBset magic\fR was given.) |
| 520 |
.TP |
| 521 |
.BI formatter " program " \fR[ "argument " \fR...] |
| 522 |
Run the given \fIprogram\fR on the full contents of the current buffer. |
| 523 |
.TP |
| 524 |
.BI linter " program " \fR[ "argument " \fR...] |
| 525 |
Use the given \fIprogram\fR to run a syntax check on the current buffer. |
| 526 |
.TP |
| 527 |
.BI "comment """ string """" |
| 528 |
Use the given \fIstring\fR for commenting and uncommenting lines. |
| 529 |
If the string contains a vertical bar or pipe character (\fB|\fR), |
| 530 |
this designates bracket-style comments; for example, "\fB/*|*/\fR" for |
| 531 |
CSS files. The characters before the pipe are prepended to the line and the |
| 532 |
characters after the pipe are appended at the end of the line. If no pipe |
| 533 |
character is present, the full string is prepended; for example, "\fB#\fR" |
| 534 |
for Python files. If empty double quotes are specified, the comment/uncomment |
| 535 |
function is disabled; for example, "" for JSON. |
| 536 |
The default value is "\fB#\fR". |
| 537 |
.TP |
| 538 |
.BI "tabgives """ string """" |
| 539 |
Make the <Tab> key produce the given \fIstring\fR. Useful for languages like |
| 540 |
Python that want to see only spaces for indentation. |
| 541 |
This overrides the setting of the \fBtabstospaces\fR option. |
| 542 |
.TP |
| 543 |
.BI "color \fR[\fBbold,\fR][\fBitalic,\fR]" fgcolor , bgcolor " """ regex """ " \fR... |
| 544 |
Paint all pieces of text that match the extended regular expression |
| 545 |
\fIregex\fR with the given foreground and background colors, at least |
| 546 |
one of which must be specified. Valid color names are: |
| 547 |
.BR red ", " green ", " blue ", " \%magenta ", " \%yellow ", " \%cyan , |
| 548 |
.BR white ", and " black . |
| 549 |
Each of these eight names may be prefixed with the word \fBlight\fR |
| 550 |
to get a brighter version of that color. |
| 551 |
The word \fBgrey\fR or \fBgray\fR may be used |
| 552 |
as a synonym for \fB\%lightblack\fR. |
| 553 |
On a Linux console, \fBlight\fR does not have |
| 554 |
any effect for a background color. |
| 555 |
On terminal emulators that can do at least 256 colors, |
| 556 |
other valid (but unprefixable) color names are: |
| 557 |
.BR pink ", " \%purple ", " mauve ", " \%lagoon ", " mint ", " lime ", " peach , |
| 558 |
.BR \%orange ", " \%latte ", " \%rosy ", " beet ", " plum ", " sea ", " sky , |
| 559 |
.BR slate ", " teal ", " sage ", " brown ", " \%ocher ", " sand ", " \%tawny , |
| 560 |
.BR brick ", " \%crimson ", and " \%normal |
| 561 |
\(em where \fB\%normal\fR means the default foreground or background color. |
| 562 |
On such emulators, the color may also be specified as a three-digit hexadecimal |
| 563 |
number prefixed with \fB#\fR, with the digits representing the amounts of red, |
| 564 |
green, and blue, respectively. This tells \fBnano\fR to select from the |
| 565 |
available palette the color that approximates the given values. |
| 566 |
|
| 567 |
The color pair may be preceded by \fBbold\fR and/or \fB\%italic\fR |
| 568 |
(separated by commas) to get a bold and/or slanting typeface, |
| 569 |
if your terminal can do those. |
| 570 |
.sp |
| 571 |
All coloring commands are applied in the order in which they are specified, |
| 572 |
which means that later commands can recolor stuff that was colored earlier. |
| 573 |
.TP |
| 574 |
.BI "icolor \fR[\fBbold,\fR][\fBitalic,\fR]" fgcolor , bgcolor " """ regex """ " \fR... |
| 575 |
Same as above, except that the matching is case insensitive. |
| 576 |
.TP |
| 577 |
.BI "color \fR[\fBbold,\fR][\fBitalic,\fR]" fgcolor , bgcolor " start=""" fromrx """ end=""" torx """" |
| 578 |
Paint all pieces of text whose start matches extended regular expression |
| 579 |
\fIfromrx\fR and whose end matches extended regular expression \fItorx\fR |
| 580 |
with the given foreground and background colors, |
| 581 |
at least one of which must be specified. This means that, after an |
| 582 |
initial instance of \fIfromrx\fR, all text until the first instance of |
| 583 |
\fItorx\fR is colored. This allows syntax highlighting to span |
| 584 |
multiple lines. |
| 585 |
.TP |
| 586 |
.BI "icolor \fR[\fBbold,\fR][\fBitalic,\fR]" fgcolor , bgcolor " start=""" fromrx """ end=""" torx """" |
| 587 |
Same as above, except that the matching is case insensitive. |
| 588 |
.TP |
| 589 |
.BI "include """ syntaxfile """" |
| 590 |
Read in self-contained color syntaxes from \fIsyntaxfile\fR. Note that |
| 591 |
\fIsyntaxfile\fR may contain only the above commands, from \fBsyntax\fR |
| 592 |
to \fBicolor\fR. |
| 593 |
.TP |
| 594 |
.BI extendsyntax " name command argument " \fR... |
| 595 |
Extend the syntax previously defined as \fIname\fR with another |
| 596 |
\fI\%command\fR. This allows adding a new \fB\%color\fR, \fB\%icolor\fR, |
| 597 |
\fB\%header\fR, \fB\%magic\fR, \fB\%formatter\fR, \fB\%linter\fR, |
| 598 |
\fB\%comment\fR, or \fB\%tabgives\fR |
| 599 |
command to an already defined syntax \(em useful when you want to |
| 600 |
slightly improve a syntax defined in one of the system-installed |
| 601 |
files (which normally are not writable). |
| 602 |
|
| 603 |
.SH REBINDING KEYS |
| 604 |
Key bindings can be changed via the following three commands: |
| 605 |
.RS 3 |
| 606 |
.TP |
| 607 |
.BI bind " key function menu" |
| 608 |
Rebinds the given \fIkey\fR to the given \fIfunction\fR in the given \fImenu\fR |
| 609 |
(or in all menus where the function exists when \fBall\fR is used). |
| 610 |
.TP |
| 611 |
.BI bind " key " """" string """" " menu" |
| 612 |
Makes the given \fIkey\fR produce the given \fIstring\fR in the given |
| 613 |
\fImenu\fR (or in all menus where the key exists when \fBall\fR is used). |
| 614 |
Besides literal text and/or control codes, the \fIstring\fR may contain |
| 615 |
function names between braces. These functions are invoked when |
| 616 |
the key is typed. To include a literal opening brace, use \fB{{}\fR. |
| 617 |
.TP |
| 618 |
.BI unbind " key menu" |
| 619 |
Unbinds the given \fIkey\fR from the given \fImenu\fR (or from all |
| 620 |
menus where the key exists when \fBall\fR is used). |
| 621 |
.RE |
| 622 |
.sp |
| 623 |
Note that \fBbind \fIkey\fR \fB"{\fIfunction\fB}"\fR \fImenu\fR is equivalent |
| 624 |
to \fBbind \fIkey\fR \fIfunction\fR \fImenu\fR, except that for the latter form |
| 625 |
\fBnano\fR checks the availability of the \fIfunction\fR in the given \fImenu\fR |
| 626 |
at startup time (and reports an error if it does not exist there), whereas for the |
| 627 |
first form \fBnano\fR checks at execution time that the \fIfunction\fR exists |
| 628 |
but not whether it makes any sense in the current menu. The user has to take care |
| 629 |
that a function name between braces (or any sequence of them) is appropriate. |
| 630 |
Strange behavior or even a crash can result when the braced name is unfitting. |
| 631 |
|
| 632 |
.TP |
| 633 |
The format of \fIkey\fR should be one of: |
| 634 |
.RS 3 |
| 635 |
.TP 7 |
| 636 |
.BI ^ X |
| 637 |
where \fIX\fR is a Latin letter, or one of several ASCII characters |
| 638 |
(@, ], \e, ^, _), or the word "Space". |
| 639 |
Example: ^C. |
| 640 |
.TP |
| 641 |
.BI M\- X |
| 642 |
where \fIX\fR is any ASCII character (except [), |
| 643 |
or the word "Space", "Left", "Right", "Up", or "Down". |
| 644 |
Example: M\-8. |
| 645 |
.TP |
| 646 |
.BI Sh\-M\- X |
| 647 |
where \fIX\fR is a Latin letter. |
| 648 |
Example: Sh\-M\-U. |
| 649 |
By default, each Meta+letter keystroke does the same as the corresponding |
| 650 |
Shift+Meta+letter. But when any Shift+Meta bind is made, that will |
| 651 |
no longer be the case, for all letters. |
| 652 |
.TP |
| 653 |
.BI F N |
| 654 |
where \fIN\fR is a numeric value from 1 to 24. |
| 655 |
Example: F10. |
| 656 |
(Often, \fBF13\fR to \fBF24\fR can be typed as \fBF1\fR to \fBF12\fR with Shift.) |
| 657 |
.TP |
| 658 |
.BR Ins " or " Del . |
| 659 |
.RE |
| 660 |
.sp |
| 661 |
Rebinding \fB^M\fR (Enter) or \fB^I\fR (Tab) is probably not a good idea. |
| 662 |
Rebinding \fB^[\fR (Esc) is not possible, because its keycode |
| 663 |
is the starter byte of Meta keystrokes and escape sequences. |
| 664 |
Rebinding any of the dedicated cursor-moving keys (the arrows, |
| 665 |
Home, End, PageUp and PageDown) is not possible. |
| 666 |
On some terminals it's not possible to rebind \fB^H\fR (unless \fB\-\-raw\fR |
| 667 |
is used) because its keycode is identical to that of the Backspace key. |
| 668 |
|
| 669 |
.TP |
| 670 |
Valid \fIfunction\fR names to be bound are: |
| 671 |
.RS 3 |
| 672 |
.TP 2 |
| 673 |
.B help |
| 674 |
Invokes the help viewer. |
| 675 |
.TP |
| 676 |
.B cancel |
| 677 |
Cancels the current command. |
| 678 |
.TP |
| 679 |
.B exit |
| 680 |
Exits from the program (or from the help viewer or file browser). |
| 681 |
.TP |
| 682 |
.B writeout |
| 683 |
Writes the current buffer to disk, asking for a name. |
| 684 |
.TP |
| 685 |
.B savefile |
| 686 |
Writes the current file to disk without prompting. |
| 687 |
.TP |
| 688 |
.B insert |
| 689 |
Inserts a file into the current buffer (at the current cursor position), |
| 690 |
or into a new buffer when option \fBmultibuffer\fR is set. |
| 691 |
.TP |
| 692 |
.B whereis |
| 693 |
Starts a forward search for text in the current buffer \(em or for filenames |
| 694 |
matching a string in the current list in the file browser. |
| 695 |
.TP |
| 696 |
.B wherewas |
| 697 |
Starts a backward search for text in the current buffer \(em or for filenames |
| 698 |
matching a string in the current list in the file browser. |
| 699 |
.TP |
| 700 |
.B findprevious |
| 701 |
Searches the next occurrence in the backward direction. |
| 702 |
.TP |
| 703 |
.B findnext |
| 704 |
Searches the next occurrence in the forward direction. |
| 705 |
.TP |
| 706 |
.B replace |
| 707 |
Interactively replaces text within the current buffer. |
| 708 |
.TP |
| 709 |
.B cut |
| 710 |
Cuts and stores the current line (or the marked region). |
| 711 |
.TP |
| 712 |
.B copy |
| 713 |
Copies the current line (or the marked region) without deleting it. |
| 714 |
.TP |
| 715 |
.B paste |
| 716 |
Pastes the currently stored text into the current buffer at the |
| 717 |
current cursor position. |
| 718 |
.TP |
| 719 |
.B zap |
| 720 |
Throws away the current line (or the marked region). |
| 721 |
(This function is bound by default to <Meta+Delete>.) |
| 722 |
.TP |
| 723 |
.B chopwordleft |
| 724 |
Deletes from the cursor position to the beginning of the preceding word. |
| 725 |
(This function is bound by default to <Shift+Ctrl+Delete>. If your terminal |
| 726 |
produces \fB^H\fR for <Ctrl+Backspace>, you can make <Ctrl+Backspace> delete |
| 727 |
the word to the left of the cursor by rebinding \fB^H\fR to this function.) |
| 728 |
.TP |
| 729 |
.B chopwordright |
| 730 |
Deletes from the cursor position to the beginning of the next word. |
| 731 |
(This function is bound by default to <Ctrl+Delete>.) |
| 732 |
.TP |
| 733 |
.B cutrestoffile |
| 734 |
Cuts all text from the cursor position till the end of the buffer. |
| 735 |
.TP |
| 736 |
.B mark |
| 737 |
Sets the mark at the current position, to start selecting text. |
| 738 |
Or, when it is set, unsets the mark. |
| 739 |
.TP |
| 740 |
.B location |
| 741 |
Reports the current position of the cursor in the buffer: |
| 742 |
the line, column, and character positions. |
| 743 |
.TP |
| 744 |
.B wordcount |
| 745 |
Counts and reports on the status bar the number of lines, words, |
| 746 |
and characters in the current buffer (or in the marked region). |
| 747 |
.TP |
| 748 |
.B execute |
| 749 |
Prompts for a program to execute. The program's output is inserted |
| 750 |
into the current buffer \(em or into a new buffer when \fBM\-F\fR is toggled. |
| 751 |
When the program's name is preceded by a pipe symbol (\fB|\fR), then the |
| 752 |
current buffer (or the marked region) is piped to the program, and the |
| 753 |
output of the program replaces the buffer (or the marked region). |
| 754 |
.TP |
| 755 |
.B speller |
| 756 |
Invokes a spell-checking program, either the default \fBhunspell\fR(1) or GNU |
| 757 |
\fBspell\fR(1), or the one defined by \fB\-\-speller\fR or \fBset speller\fR. |
| 758 |
.TP |
| 759 |
.B formatter |
| 760 |
Invokes a full-buffer-processing program (if the active syntax defines one). |
| 761 |
(The current buffer is written out to a temporary file, the program |
| 762 |
is run on it, and then the temporary file is read back in, replacing |
| 763 |
the contents of the buffer.) |
| 764 |
.TP |
| 765 |
.B linter |
| 766 |
Invokes a syntax-checking program (if the active syntax defines one). |
| 767 |
If this program produces lines of the form "filename:linenum:charnum: |
| 768 |
some message", then the cursor is put at the indicated position |
| 769 |
in the mentioned file while showing "some message" on the status bar. |
| 770 |
You can move from message to message with <PgUp> and <PgDn>, |
| 771 |
and leave linting mode with \fB^C\fR or <Enter>. |
| 772 |
.TP |
| 773 |
.B justify |
| 774 |
Justifies the current paragraph (or the marked region). |
| 775 |
A paragraph is a group of contiguous lines that, apart from possibly |
| 776 |
the first line, all have the same indentation. The beginning of a |
| 777 |
paragraph is detected by either this lone line with a differing |
| 778 |
indentation or by a preceding blank line. |
| 779 |
.TP |
| 780 |
.B fulljustify |
| 781 |
Justifies the entire current buffer (or the marked region). |
| 782 |
.TP |
| 783 |
.B indent |
| 784 |
Indents (shifts to the right) the current line or the marked lines. |
| 785 |
.TP |
| 786 |
.B unindent |
| 787 |
Unindents (shifts to the left) the current line or the marked lines. |
| 788 |
.TP |
| 789 |
.B comment |
| 790 |
Comments or uncomments the current line or the marked lines, |
| 791 |
using the comment style specified in the active syntax. |
| 792 |
.TP |
| 793 |
.B complete |
| 794 |
Completes (when possible) the fragment before the cursor |
| 795 |
to a full word found elsewhere in the current buffer. |
| 796 |
.TP |
| 797 |
.B left |
| 798 |
Goes left one position (in the editor or browser). |
| 799 |
.TP |
| 800 |
.B right |
| 801 |
Goes right one position (in the editor or browser). |
| 802 |
.TP |
| 803 |
.B up |
| 804 |
Goes one line up (in the editor or browser). |
| 805 |
.TP |
| 806 |
.B down |
| 807 |
Goes one line down (in the editor or browser). |
| 808 |
.TP |
| 809 |
.B scrollleft |
| 810 |
Scrolls the viewport a tabsize to the left, when possible. |
| 811 |
(This function is bound by default to \fBM-<\fR.) |
| 812 |
.TP |
| 813 |
.B scrollright |
| 814 |
Scrolls the viewport a tabsize to the right. When needed to keep |
| 815 |
the cursor visible, it is moved to a longer line in the viewport. |
| 816 |
If there is no sufficiently longer line, no scroll is made. |
| 817 |
(This function is bound by default to \fBM->\fR.) |
| 818 |
.TP |
| 819 |
.B scrollup |
| 820 |
Scrolls the viewport up one row (meaning that the text slides down) |
| 821 |
while keeping the cursor in the same text position, if possible. |
| 822 |
(This function is bound by default to \fBM-Up\fR. |
| 823 |
If \fBM-Up\fR does nothing on your Linux console, see the FAQ: |
| 824 |
.UR https://nano\-editor.org/dist/latest/faq.html#4.1 |
| 825 |
.UE .) |
| 826 |
.TP |
| 827 |
.B scrolldown |
| 828 |
Scrolls the viewport down one row (meaning that the text slides up) |
| 829 |
while keeping the cursor in the same text position, if possible. |
| 830 |
(This function is bound by default to \fBM-Down\fR.) |
| 831 |
.TP |
| 832 |
.B center |
| 833 |
Scrolls the line with the cursor to the middle of the viewport. |
| 834 |
.TP |
| 835 |
.B cycle |
| 836 |
Scrolls the line with the cursor first to the middle of the viewport, |
| 837 |
then to the top, then to the bottom. |
| 838 |
.TP |
| 839 |
.B prevword |
| 840 |
Moves the cursor to the beginning of the previous word. |
| 841 |
.TP |
| 842 |
.B nextword |
| 843 |
Moves the cursor to the beginning of the next word. |
| 844 |
.TP |
| 845 |
.B home |
| 846 |
Moves the cursor to the beginning of the current line. |
| 847 |
.TP |
| 848 |
.B end |
| 849 |
Moves the cursor to the end of the current line. |
| 850 |
.TP |
| 851 |
.B beginpara |
| 852 |
Moves the cursor to the beginning of the current paragraph. |
| 853 |
.TP |
| 854 |
.B endpara |
| 855 |
Moves the cursor to the end of the current paragraph. |
| 856 |
.TP |
| 857 |
.B prevblock |
| 858 |
Moves the cursor to the beginning of the current or preceding block of text. |
| 859 |
(Blocks are separated by one or more blank lines.) |
| 860 |
.TP |
| 861 |
.B nextblock |
| 862 |
Moves the cursor to the beginning of the next block of text. |
| 863 |
.TP |
| 864 |
.B toprow |
| 865 |
Moves the cursor to the first row in the viewport. |
| 866 |
.TP |
| 867 |
.B bottomrow |
| 868 |
Moves the cursor to the last row in the viewport. |
| 869 |
.TP |
| 870 |
.B pageup |
| 871 |
Goes up one screenful. |
| 872 |
.TP |
| 873 |
.B pagedown |
| 874 |
Goes down one screenful. |
| 875 |
.TP |
| 876 |
.B firstline |
| 877 |
Goes to the first line of the file. |
| 878 |
.TP |
| 879 |
.B lastline |
| 880 |
Goes to the last line of the file. |
| 881 |
.TP |
| 882 |
.B gotoline |
| 883 |
Goes to a specific line (and column if given). |
| 884 |
A negative number counts from the end of the buffer (and end of the line). |
| 885 |
Putting \fB++\fR or \fB\-\-\fR before the first number will jump the given |
| 886 |
number of lines forward or backward. |
| 887 |
.TP |
| 888 |
.B findbracket |
| 889 |
Moves the cursor to the bracket (or brace or parenthesis, etc.\&) that matches |
| 890 |
(pairs) with the one under the cursor. See \fBset matchbrackets\fR. |
| 891 |
.TP |
| 892 |
.B anchor |
| 893 |
Places an anchor at the current line, or removes it when already present. |
| 894 |
(An anchor is visible when line numbers are activated.) |
| 895 |
.TP |
| 896 |
.B prevanchor |
| 897 |
Goes to the first anchor before the current line. |
| 898 |
.TP |
| 899 |
.B nextanchor |
| 900 |
Goes to the first anchor after the current line. |
| 901 |
.TP |
| 902 |
.B prevbuf |
| 903 |
Switches to editing/viewing the previous buffer when multiple buffers are open. |
| 904 |
.TP |
| 905 |
.B nextbuf |
| 906 |
Switches to editing/viewing the next buffer when multiple buffers are open. |
| 907 |
.TP |
| 908 |
.B verbatim |
| 909 |
Inserts the next keystroke verbatim into the file, or begins Unicode input |
| 910 |
when a hexadecimal digit is typed. |
| 911 |
.TP |
| 912 |
.B tab |
| 913 |
Inserts a tab at the current cursor location. |
| 914 |
.TP |
| 915 |
.B enter |
| 916 |
Inserts a new line below the current one. |
| 917 |
.TP |
| 918 |
.B delete |
| 919 |
Deletes the character under the cursor. |
| 920 |
.TP |
| 921 |
.B backspace |
| 922 |
Deletes the character before the cursor. |
| 923 |
.TP |
| 924 |
.B recordmacro |
| 925 |
Starts the recording of keystrokes \(em the keystrokes are stored |
| 926 |
as a macro. When already recording, the recording is stopped. |
| 927 |
.TP |
| 928 |
.B runmacro |
| 929 |
Replays the keystrokes of the last recorded macro. |
| 930 |
.TP |
| 931 |
.B undo |
| 932 |
Undoes the last performed text action (add text, delete text, etc). |
| 933 |
.TP |
| 934 |
.B redo |
| 935 |
Redoes the last undone action (i.e., it undoes an undo). |
| 936 |
.TP |
| 937 |
.B refresh |
| 938 |
Refreshes the screen. |
| 939 |
.TP |
| 940 |
.B suspend |
| 941 |
Suspends the editor and returns control to the shell |
| 942 |
(until you tell the process to resume execution with \fBfg\fR). |
| 943 |
.TP |
| 944 |
.B casesens |
| 945 |
Toggles whether searching/replacing ignores or respects the case of |
| 946 |
the given characters. |
| 947 |
.TP |
| 948 |
.B regexp |
| 949 |
Toggles whether searching/replacing uses literal strings or regular expressions. |
| 950 |
.TP |
| 951 |
.B backwards |
| 952 |
Toggles whether searching/replacing goes forward or backward. |
| 953 |
.TP |
| 954 |
.B older |
| 955 |
Retrieves the previous (earlier) entry at a prompt. |
| 956 |
.TP |
| 957 |
.B newer |
| 958 |
Retrieves the next (later) entry at a prompt. |
| 959 |
.TP |
| 960 |
.B flipreplace |
| 961 |
Toggles between searching for something and replacing something. |
| 962 |
.TP |
| 963 |
.B flipgoto |
| 964 |
Toggles between searching for text and targeting a line number. |
| 965 |
.TP |
| 966 |
.B flipexecute |
| 967 |
Switches from inserting a file to executing a command. |
| 968 |
.TP |
| 969 |
.B flippipe |
| 970 |
When executing a command, toggles whether the current buffer (or marked |
| 971 |
region) is piped to the command. |
| 972 |
.TP |
| 973 |
.B flipnewbuffer |
| 974 |
Toggles between inserting into the current buffer and into a new |
| 975 |
empty buffer. |
| 976 |
.TP |
| 977 |
.B flipconvert |
| 978 |
When reading in a file, toggles between converting and not converting |
| 979 |
it from DOS/Mac format. Converting is the default. |
| 980 |
.TP |
| 981 |
.B dosformat |
| 982 |
When writing a file, switches to writing a DOS format (CR/LF). |
| 983 |
.TP |
| 984 |
.B macformat |
| 985 |
When writing a file, switches to writing a Mac format. |
| 986 |
.TP |
| 987 |
.B append |
| 988 |
When writing a file, appends to the end instead of overwriting. |
| 989 |
.TP |
| 990 |
.B prepend |
| 991 |
When writing a file, "prepends" (writes at the beginning) instead of overwriting. |
| 992 |
.TP |
| 993 |
.B backup |
| 994 |
When writing a file, creates a backup of the current file. |
| 995 |
.TP |
| 996 |
.B discardbuffer |
| 997 |
Discards the current buffer without saving (when in the Write Out menu). |
| 998 |
When it was the last buffer, then \fBnano\fR exits with error status 2. |
| 999 |
.TP |
| 1000 |
.B browser |
| 1001 |
Starts the file browser (in the Read File and Write Out menus), |
| 1002 |
allowing to select a file from a list. |
| 1003 |
.TP |
| 1004 |
.B gotodir |
| 1005 |
Goes to a directory to be specified, allowing to browse anywhere |
| 1006 |
in the filesystem. |
| 1007 |
.TP |
| 1008 |
.B firstfile |
| 1009 |
Goes to the first file in the list when using the file browser. |
| 1010 |
.TP |
| 1011 |
.B lastfile |
| 1012 |
Goes to the last file in the list when using the file browser. |
| 1013 |
.TP |
| 1014 |
.B nohelp |
| 1015 |
Toggles the presence of the two-line list of key bindings at the bottom of the screen. |
| 1016 |
(This toggle is special: it is available in all menus except the help viewer |
| 1017 |
and the linter. All further toggles are available in the main menu only.) |
| 1018 |
.TP |
| 1019 |
.B zero |
| 1020 |
Toggles the presence of title bar and status bar. |
| 1021 |
.TP |
| 1022 |
.B constantshow |
| 1023 |
Toggles the constant reporting (on the status bar) |
| 1024 |
of the current line, column, and character positions. |
| 1025 |
.TP |
| 1026 |
.B softwrap |
| 1027 |
Toggles the displaying of overlong lines on multiple screen lines. |
| 1028 |
.TP |
| 1029 |
.B linenumbers |
| 1030 |
Toggles the display of line numbers in front of the text. |
| 1031 |
.TP |
| 1032 |
.B whitespacedisplay |
| 1033 |
Toggles the showing of whitespace. |
| 1034 |
.TP |
| 1035 |
.B nosyntax |
| 1036 |
Toggles syntax highlighting. |
| 1037 |
.TP |
| 1038 |
.B smarthome |
| 1039 |
Toggles the smartness of the Home key. |
| 1040 |
.TP |
| 1041 |
.B autoindent |
| 1042 |
Toggles whether a newly created line will contain the same amount of leading |
| 1043 |
whitespace as the preceding line \(em or as the next line if the preceding line |
| 1044 |
is the beginning of a paragraph. |
| 1045 |
.TP |
| 1046 |
.B cutfromcursor |
| 1047 |
Toggles whether cutting text cuts the whole line or just from the current cursor |
| 1048 |
position to the end of the line. |
| 1049 |
.TP |
| 1050 |
.B breaklonglines |
| 1051 |
Toggles whether the overlong part of a line is hard-wrapped to the next line. |
| 1052 |
.TP |
| 1053 |
.B tabstospaces |
| 1054 |
Toggles whether typed tabs are converted to spaces. |
| 1055 |
.TP |
| 1056 |
.B mouse |
| 1057 |
Toggles mouse support. |
| 1058 |
.RE |
| 1059 |
|
| 1060 |
.TP |
| 1061 |
Valid \fImenu\fR sections are: |
| 1062 |
.RS 3 |
| 1063 |
.TP 2 |
| 1064 |
.B main |
| 1065 |
The main editor window where text is entered and edited. |
| 1066 |
.TP |
| 1067 |
.B help |
| 1068 |
The help-viewer menu. |
| 1069 |
.TP |
| 1070 |
.B search |
| 1071 |
The search menu (AKA whereis). |
| 1072 |
.TP |
| 1073 |
.B replace |
| 1074 |
The \&'search to replace' menu. |
| 1075 |
.TP |
| 1076 |
.B replacewith |
| 1077 |
The \&'replace with' menu, which comes up after \&'search to replace'. |
| 1078 |
.TP |
| 1079 |
.B yesno |
| 1080 |
The \&'yesno' menu, where the Yes/No/All/Cancel question is asked. |
| 1081 |
.TP |
| 1082 |
.B gotoline |
| 1083 |
The \&'goto line (and column)' menu. |
| 1084 |
.TP |
| 1085 |
.B writeout |
| 1086 |
The \&'write file' menu. |
| 1087 |
.TP |
| 1088 |
.B insert |
| 1089 |
The \&'insert file' menu. |
| 1090 |
.TP |
| 1091 |
.B browser |
| 1092 |
The \&'file browser' menu, for selecting a file to be opened or |
| 1093 |
inserted or written to. |
| 1094 |
.TP |
| 1095 |
.B whereisfile |
| 1096 |
The \&'search for a file' menu in the file browser. |
| 1097 |
.TP |
| 1098 |
.B gotodir |
| 1099 |
The \&'go to directory' menu in the file browser. |
| 1100 |
.TP |
| 1101 |
.B execute |
| 1102 |
The menu for inserting the output from an external command, |
| 1103 |
or for filtering the buffer (or the marked region) through |
| 1104 |
an external command, or for executing one of several tools. |
| 1105 |
.TP |
| 1106 |
.B spell |
| 1107 |
The menu of the integrated spell checker where the user can edit a misspelled word. |
| 1108 |
.TP |
| 1109 |
.B linter |
| 1110 |
The linter menu, which allows jumping through the linting messages. |
| 1111 |
.TP |
| 1112 |
.B all |
| 1113 |
A special name that encompasses all menus. |
| 1114 |
For \fBbind\fR it means all menus where the specified \fIfunction\fR exists; |
| 1115 |
for \fBunbind\fR it means all menus where the specified \fIkey\fR exists. |
| 1116 |
.RE |
| 1117 |
|
| 1118 |
.SH EXAMPLES |
| 1119 |
To make \fBCtrl+Z\fR suspend nano: |
| 1120 |
.sp |
| 1121 |
.RS |
| 1122 |
.B bind ^Z suspend main |
| 1123 |
.RE |
| 1124 |
.sp |
| 1125 |
To make \fBShift+Alt+C\fR copy the marked region to the system's clipboard: |
| 1126 |
.sp |
| 1127 |
.RS |
| 1128 |
.B bind Sh\-M\-C """{execute}| xsel \-ib {enter}{undo}""" main |
| 1129 |
.RE |
| 1130 |
.sp |
| 1131 |
|
| 1132 |
.SH FILES |
| 1133 |
.TP |
| 1134 |
.I /etc/nanorc |
| 1135 |
System-wide configuration file. |
| 1136 |
.TP |
| 1137 |
.IR ~/.nanorc " or " $XDG_CONFIG_HOME/nano/nanorc " or " ~/.config/nano/nanorc |
| 1138 |
Per-user configuration file. |
| 1139 |
.TP |
| 1140 |
.I /usr/share/nano/* |
| 1141 |
Syntax definitions for the syntax coloring of common file types |
| 1142 |
(and for less common file types in the \fIextra/\fR subdirectory). |
| 1143 |
|
| 1144 |
.SH SEE ALSO |
| 1145 |
.BR nano (1) |
| 1146 |
.TP |
| 1147 |
.I https://nano\-editor.org/cheatsheet.html |
| 1148 |
An overview of the default key bindings. |