nanorc.sample 15.7 KB
Newer Older
1
2
## Sample initialization file for GNU nano.
##
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
3
## Please note that you must have configured nano with --enable-nanorc
4
5
6
## for this file to be read!  Also note that this file should not be in
## DOS or Mac format, and that characters specially interpreted by the
## shell should not be escaped here.
7
##
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
8
## To make sure a value is disabled, use "unset <option>".
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
9
10
11
##
## For the options that take parameters, the default value is given.
## Other options are unset by default.
12
13
14
##
## Quotes inside string parameters don't have to be escaped with
## backslashes.  The last double quote in the string will be treated as
15
## its end.  For example, for the "brackets" option, ""')>]}" will match
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
16
## ", ', ), >, ], and }.
17

18
## Use auto-indentation.
19
20
# set autoindent

21
## Backup files to filename~.
22
# set backup
23

24
## The directory to put unique backup files in.
25
26
# set backupdir ""

27
28
29
## Do backwards searches by default.
# set backwards

30
31
32
## Use bold text instead of reverse video text.
# set boldtext

33
34
35
36
## The characters treated as closing brackets when justifying
## paragraphs.  They cannot contain blank characters.  Only closing
## punctuation, optionally followed by closing brackets, can end
## sentences.
37
##
38
# set brackets ""')>]}"
39

40
41
42
## Do case sensitive searches by default.
# set casesensitive

43
## Constantly display the cursor position in the statusbar.  Note that
44
## this overrules "quickblank".
45
46
# set const

47
## Use cut to end of line by default.
48
49
# set cut

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
50
## Set the line length for wrapping text and justifying paragraphs.
51
## If fill is 0 or less, the line length will be the screen width less
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
52
53
54
55
56
57
## this number.
##
# set fill -8

## Enable ~/.nano_history for saving and reading search/replace strings.
# set historylog
58

59
## The opening and closing brackets that can be found by bracket
60
61
## searches.  They cannot contain blank characters.  The former set must
## come before the latter set, and both must be in the same order.
62
63
64
##
# set matchbrackets "(<[{)>]}"

65
66
67
## Use the blank line below the titlebar as extra editing space.
# set morespace

68
69
70
71
72
## Enable mouse support, if available for your system.  When enabled,
## mouse clicks can be used to place the cursor, set the mark (with a
## double click), and execute shortcuts.  The mouse will work in the X
## Window System, and on the console when gpm is running.
##
73
74
# set mouse

75
76
## Allow multiple file buffers (inserting a file will put it into a
## separate buffer).  You must have configured with --enable-multibuffer
77
## for this to work.
78
##
79
# set multibuffer
80

81
## Don't convert files from DOS/Mac format.
82
# set noconvert
83

84
## Don't follow symlinks when writing files.
85
86
# set nofollow

87
## Don't display the helpful shortcut lists at the bottom of the screen.
88
89
# set nohelp

90
91
92
## Don't add newlines to the ends of files.
# set nonewlines

93
## Don't wrap text at all.
94
95
# set nowrap

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
96
97
## Set operating directory.  nano will not read or write files outside
## this directory and its subdirectories.  Also, the current directory
98
## is changed to here, so any files are inserted from this dir.  A blank
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
99
100
101
## string means the operating directory feature is turned off.
##
# set operatingdir ""
102

103
## Preserve the XON and XOFF keys (^Q and ^S).
104
# set preserve
105

106
107
108
109
## The characters treated as closing punctuation when justifying
## paragraphs.  They cannot contain blank characters.  Only closing
## punctuation, optionally followed by closing brackets, can end
## sentences.
110
##
111
# set punct "!.?"
112

113
## Do quick statusbar blanking.  Statusbar messages will disappear after
114
## 1 keystroke instead of 26.  Note that "const" overrules this.
115
116
117
##
# set quickblank

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
118
119
120
## The email-quote string, used to justify email-quoted paragraphs.
## This is an extended regular expression if your system supports them,
## otherwise a literal string.  Default:
121
# set quotestr "^([ 	]*[#:>\|}])+"
122
## if you have extended regular expression support, otherwise:
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
123
# set quotestr "> "
124

125
## Fix Backspace/Delete confusion problem.
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
126
127
# set rebinddelete

128
129
130
## Fix numeric keypad key confusion problem.
# set rebindkeypad

131
132
133
## Do extended regular expression searches by default.
# set regexp

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
134
135
136
137
138
139
140
## Make the Home key smarter.  When Home is pressed anywhere but at the
## very beginning of non-whitespace characters on a line, the cursor
## will jump to that beginning (either forwards or backwards).  If the
## cursor is already at that position, it will jump to the true
## beginning of the line.
# set smarthome

141
## Use smooth scrolling as the default.
142
# set smooth
143

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
144
145
146
## Use this spelling checker instead of the internal one.  This option
## does not properly have a default value.
##
147
# set speller "aspell -x -c"
148

149
## Allow nano to be suspended.
150
151
# set suspend

152
## Use this tab size instead of the default; it must be greater than 0.
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
153
# set tabsize 8
154

155
156
157
## Convert typed tabs to spaces.
# set tabstospaces

158
## Save automatically on exit, don't prompt.
159
# set tempfile
160

161
## Disallow file modification; why would you want this in an rcfile? ;)
162
# set view
163

164
## The two single-column characters used to display the first characters
165
166
## of tabs and spaces.  187 in ISO 8859-1 (0000BB in Unicode) and 183 in
## ISO-8859-1 (0000B7 in Unicode) seem to be good values for these.
167
168
# set whitespace "  "

169
170
171
172
## Detect word boundaries more accurately by treating punctuation
## characters as part of a word.
# set wordbounds

173

174
## Color setup
175
##
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
176
## Format:
177
##
178
## syntax "short description" ["filename regex" ...]
179
##
180
## The "none" syntax is reserved; specifying it on the command line is
181
182
## the same as not having a syntax at all.  The "default" syntax is
## special: it takes no filename regexes, and applies to files that
183
## don't match any other syntax's filename regexes.
184
##
185
## color foreground,background "regex" ["regex"...]
186
187
188
## or
## icolor foreground,background "regex" ["regex"...]
##
189
190
## "color" will do case sensitive matches, while "icolor" will do case
## insensitive matches.
191
##
192
193
194
## Valid colors: white, black, red, blue, green, yellow, magenta, cyan.
## For foreground colors, you may use the prefix "bright" to get a
## stronger highlight.
195
##
196
197
## To use multi-line regexes, use the start="regex" end="regex"
## [start="regex" end="regex"...] format.
198
##
199
200
201
## If your system supports transparency, not specifying a background
## color will use a transparent color.  If you don't want this, be sure
## to set the background color to black or white.
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
202
##
203
204
205
206
207
208
## If you wish, you may put your syntaxes in separate files.  You can
## make use of such files (which can only include "syntax", "color", and
## "icolor" commands) as follows:
##
## include "syntax file"
##
209
## All regexes should be extended regular expressions.
210
211
212


## Here is an example for C/C++.
213
##
214
# syntax "c-file" "\.(c|C|cc|cpp|cxx|h|H|hh|hpp|hxx)$"
215
# color brightred "\<[A-Z_][0-9A-Z_]+\>" 
216
# color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>"
217
# color green "\<(u_?)?int(8|16|32|64|ptr)_t\>"
218
# color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\>"
219
# color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
220
# color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
221
# color magenta "\<(goto|continue|break|return)\>"
222
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
223
# color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
224
##
225
## GCC builtins
226
# color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
227
##
228
229
230
## String highlighting.  You will in general want your comments and
## strings to come last, because syntax highlighting rules will be
## applied in the order they are read in.
231
# color brightyellow "<[^= 	]*>" ""(\\.|[^"])*""
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
232
##
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
233
## This string is VERY resource intensive!
234
# color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
235
##
236
## Comment highlighting
237
# color brightblue "//.*"
Chris Allegretta's avatar
Chris Allegretta committed
238
# color brightblue start="/\*" end="\*/"
239

240
## Here is a short example for HTML.
241
##
242
243
# syntax "HTML" "\.html$"
# color blue start="<" end=">"
244
# color red "&[^;[[:space:]]]*;"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
245

246
## Here is a short example for TeX files.
247
##
248
# syntax "TeX" "\.tex$"
249
# icolor green "\\.|\\[A-Z]*"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
250
# color magenta "[{}]"
251
252
# color blue "%.*"

253
## Here is an example for quoted emails (under e.g. mutt).
254
##
255
256
# syntax "mutt"
# color green "^>.*"
257

258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
## Here is an example for patch files.
##
# syntax "patch" "\.(patch|diff)$"
# color brightgreen "^\+.*"
# color green "^\+\+\+.*"
# color brightblue "^ .*"
# color brightred "^-.*"
# color red "^---.*"
# color brightyellow "^@@.*"
# color magenta "^diff.*"

## Here is an example for manpages.
##
# syntax "manpage" "\.[1-9]x?$"
# color green "\.(S|T)H.*$"
# color brightgreen "\.(S|T)H" "\.TP"
# color brightred "\.(BR?|I[PR]?).*$"
# color brightblue "\.(BR?|I[PR]?|PP)"
# color brightwhite "\\f[BIPR]"
# color yellow "\.(br|DS|RS|RE|PD)"

279
## Here is an example for groff.
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
280
##
281
282
283
# syntax "groff" "\.m[ems]$" "\.rof" "\.tmac$" "^tmac."
## The argument of .ds or .nr
# color cyan "^\.(ds|nr) [^[[:space:]]]*"
284
## Single character escapes
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
285
286
# color brightmagenta "\\."
## Highlight the argument of \f or \s in the same color
287
# color brightmagenta "\\f." "\\f\(.." "\\s(\+|\-)?[0-9]"
288
## Newlines
289
# color cyan "(\\|\\\\)n(.|\(..)"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
290
# color cyan start="(\\|\\\\)n\[" end="]"
291
## Requests
292
# color brightgreen "^\.[[:space:]]*[^[[:space:]]]*"
293
## Comments
294
# color yellow "^\.\\".*$"
295
## Strings
296
# color green "(\\|\\\\)\*(.|\(..)"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
297
# color green start="(\\|\\\\)\*\[" end="]"
298
## Characters
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
299
300
# color brightred "\\\(.."
# color brightred start="\\\[" end="]"
301
## Macro arguments
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
302
303
# color brightcyan "\\\\\$[1-9]"

304
## Here is an example for Perl.
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
305
306
##
# syntax "perl" "\.p[lm]$"
307
# color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
308
# color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
309
# icolor cyan start="[$@%]" end="( |[^0-9A-Z_]|-)"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
310
311
312
313
314
315
# color yellow "".*"|qq\|.*\|"
# color white "[sm]/.*/"
# color white start="(^use| = new)" end=";"
# color green "#.*"
# color yellow start="<< 'STOP'" end="STOP"

316
## Here is an example for Python.
317
318
##
# syntax "python" "\.py$"
319
# icolor brightblue "def [0-9A-Z_]+"
320
# color brightcyan "\<(and|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|map|not|or|pass|print|raise|return|try|while)\>"
321
# color brightgreen "["'].*[^\\]["']" "["']{3}.*[^\\]["']{3}"
322
323
324
# color brightgreen start=""""[^"]" end=""""" start="'''[^']" end="'''"
# color brightred "#.*$"

325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
## Here is an example for Ruby.
# syntax "ruby" "\.rb$"
## Asciibetical list of reserved words
# color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
## Constants
# color brightblue "(\$|@|@@)?[A-Z]+[0-9A-Z_a-z]*"
## Ruby "symbols"
# icolor magenta "([ 	]|^):[0-9A-Z_]+\>"
## Some unique things we want to stand out
# color brightyellow "\<(__FILE__|__LINE__)\>"
## Regular expressions
# color brightmagenta "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
## Shell command expansion is in `backticks` or like %x{this}.  These are
## "double-quotish" (to use a perlism).
# color brightblue "`[^`]*`" "%x\{[^}]*\}"
## Strings, double-quoted
# color green ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>" "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
## Expression substitution.  These go inside double-quoted strings,
## "like #{this}".
# color brightgreen "#\{[^}]*\}"
## Strings, single-quoted
# color green "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
## Comments
# color cyan "#[^{].*$" "#$"
# color brightcyan "##[^{].*$" "##$"
## Some common markers
# color brightcyan "(XXX|TODO|FIXME|\?\?\?)"

353
## Here is an example for Java source.
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
354
355
356
357
358
##
# syntax "Java source" "\.java$"
# color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
# color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
# color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
359
# color red ""[^"]*""
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
360
361
362
363
# color yellow "\<(true|false|null)\>"
# color blue "//.*"
# color blue start="/\*" end="\*/"
# color brightblue start="/\*\*" end="\*/"
364
# color ,green "[[:space:]]+$"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
365

366
## Here is an example for assembler.
367
368
369
370
371
372
##
# syntax "asm-file" "\.(S|s|asm)$"
# color red "\<[A-Z_]{2,}\>"
# color brightgreen "\.(data|subsection|text)"
# color green "\.(align|file|globl|global|hidden|section|size|type|weak)"
# color brightyellow "\.(ascii|asciz|byte|double|float|hword|int|long|short|single|struct|word)"
373
# icolor brightred "^[[:space:]]*[.0-9A-Z_]*:"
374
375
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
## Highlight strings (note: VERY resource intensive)
376
377
# color brightyellow "<[^= 	]*>" ""(\\.|[^"])*""
# color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
378
379
380
381
## Highlight comments
# color brightblue "//.*"
# color brightblue start="/\*" end="\*/"

382
## Here is an example for Bourne shell scripts.
383
384
##
# syntax "shellscript" "\.sh$"
385
# icolor brightgreen "^[0-9A-Z_]+\(\)"
386
387
# color green "\<(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\>"
# color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
388
# color green "-[Ldefgruwx]\>"
389
390
# color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
# color brightblue "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|make|mkdir|mv|rm|sed|set|tar|touch|umask|unset)\>"
391
392
# icolor brightred "\$\{?[0-9A-Z_!@#$*-?]+\}?"
# color yellow "(^|[[:space:]])#.*$"
393
# color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
394

395
## Here is an example for your .nanorc.
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
396
##
397
# syntax "nanorc" "\.?nanorc$"
398
## Possible errors and parameters
399
# icolor brightwhite "^[[:space:]]*((un)?set|include|syntax|i?color).*$"
400
## Keywords
401
# icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace|wordbounds)\>"
402
# icolor green "^[[:space:]]*(set|unset|include|syntax)\>"
403
## Colors
404
# icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
405
# icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
406
## Strings
407
# icolor white ""(\\.|[^"])*""
408
## Comments
409
# icolor brightblue "^[[:space:]]*#.*$"