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

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

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

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

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

29
30
31
## The characters treated as closing brackets.  They cannot contain
## blank characters.  Only closing punctuation, optionally followed by
## closing brackets, can end sentences.
32
##
33
# set brackets ""')>]}"
34

35
36
37
## Do case sensitive searches by default.
# set casesensitive

38
39
## Constantly display the cursor position in the statusbar.  Note that
## this cancels out "quickblank".
40
41
# set const

42
## Use cut to end of line by default.
43
44
# set cut

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
45
## Set the line length for wrapping text and justifying paragraphs.
46
## If fill is 0 or less, the line length will be the screen width less
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
47
48
49
50
51
52
## this number.
##
# set fill -8

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

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

60
61
62
63
64
## Use the blank line below the titlebar as extra editing space.
# set morespace

## Enable mouse support, so that mouse clicks can be used to set the
## mark and run shortcuts.
65
66
# set mouse

67
68
## Allow multiple file buffers (inserting a file will put it into a
## separate buffer).  You must have configured with --enable-multibuffer
69
## for this to work.
70
##
71
# set multibuffer
72

73
## Don't convert files from DOS/Mac format.
74
# set noconvert
75

76
## Don't follow symlinks when writing files.
77
78
# set nofollow

79
## Don't display the helpful shortcut lists at the bottom of the screen.
80
81
# set nohelp

82
83
84
## Don't add newlines to the ends of files.
# set nonewlines

85
## Don't wrap text at all.
86
87
# set nowrap

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
88
89
90
91
92
93
## Set operating directory.  nano will not read or write files outside
## this directory and its subdirectories.  Also, the current directory
## is changed to here, so files are inserted from this dir.  A blank
## string means the operating directory feature is turned off.
##
# set operatingdir ""
94

95
## Preserve the XON and XOFF keys (^Q and ^S).
96
# set preserve
97

98
## The characters treated as closing punctuation.  They cannot contain
99
## blank characters.  Only closing punctuation, optionally followed by
100
101
## closing brackets, can end sentences.
##
102
# set punct "!.?"
103

104
## Do quick statusbar blanking.  Statusbar messages will disappear after
105
## 1 keystroke instead of 25.  Note that "const" cancels this out.
106
107
108
##
# set quickblank

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
109
110
111
## 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:
112
# set quotestr "^([ 	]*[#:>\|}])+"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
113
114
## if you have regexps, otherwise:
# set quotestr "> "
115

116
## Fix Backspace/Delete confusion problem.
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
117
118
# set rebinddelete

119
120
121
## Fix numeric keypad key confusion problem.
# set rebindkeypad

122
123
124
## Do extended regular expression searches by default.
# set regexp

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
125
126
127
128
129
130
131
## 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

132
## Use smooth scrolling as the default.
133
# set smooth
134

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
135
136
137
## Use this spelling checker instead of the internal one.  This option
## does not properly have a default value.
##
138
# set speller "aspell -x -c"
139

140
## Allow nano to be suspended.
141
142
# set suspend

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

146
147
148
## Convert typed tabs to spaces.
# set tabstospaces

149
## Save automatically on exit, don't prompt.
150
# set tempfile
151

152
## Disallow file modification; why would you want this in an rcfile? ;)
153
# set view
154

155
156
157
## The two single-column characters used to display the first characters
## of tabs and spaces.  187 decimal (00BB hexadecimal) and 183 decimal
## (00B7 hexadecimal) seem to be good values for these.
158
159
# set whitespace "  "

160
161
162
163
## Detect word boundaries more accurately by treating punctuation
## characters as part of a word.
# set wordbounds

164
## Color setup
165
##
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
166
## Format:
167
##
168
## syntax "short description" ["filename regex" ...]
169
##
170
171
172
173
## (The "none" syntax is reserved; specifying it on the command line is
## the same as not having a syntax at all.  The "default" syntax is
## special: it takes no filename regexes, and applies to files that
## don't match any other syntax's filename regexes.)
174
##
175
## color foreground,background "regex" ["regex"...]
176
177
178
## or
## icolor foreground,background "regex" ["regex"...]
##
179
180
## ("color" will do case sensitive matches, while "icolor" will do case
## insensitive matches.)
181
##
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
182
## Legal colors: white, black, red, blue, green, yellow, magenta, cyan.
183
184
## You may use the prefix "bright" to mean a stronger color highlight
## for the foreground.
185
##
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
186
## To use multi-line regexes, use the start="regex" end="regex" format.
187
##
188
189
190
## 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
191
##
192
# syntax "c-file" "\.(c|C|cc|cpp|cxx|h|H|hh|hpp|hxx)$"
193
# color brightred "\<[A-Z_][A-Z_0-9]+\>" 
194
# color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>"
195
# color green "\<(u_?)?int(8|16|32|64|ptr)_t\>"
196
# color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\>"
197
# color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
198
# color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
199
# color magenta "\<(goto|continue|break|return)\>"
200
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
201
# 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
202
##
203
204
## GCC builtins
##
205
# color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
206
##
207
208
## You will in general want your comments and strings to come last,
## because syntax highlighting rules will be applied in the order they
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
209
210
## are read in.
##
211
# color brightyellow "<[^= 	]*>" ""(\\.|[^"])*""
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
212
##
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
213
## This string is VERY resource intensive!
214
# color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
215
##
216
## And we want to have some nice comment highlighting too
217
# color brightblue "//.*"
Chris Allegretta's avatar
Chris Allegretta committed
218
# color brightblue start="/\*" end="\*/"
219

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
220
## Here is a short example for HTML
221
222
# syntax "HTML" "\.html$"
# color blue start="<" end=">"
223
# color red "&[^;[[:space:]]]*;"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
224
225

## Here is a short example for TeX files
226
# syntax "TeX" "\.tex$"
227
# icolor green "\\.|\\[A-Z]*"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
228
# color magenta "[{}]"
229
230
# color blue "%.*"

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
231
## Here is an example for quoted emails (under e.g. mutt)
232
233
# syntax "mutt"
# color green "^>.*"
234

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
235
236
## Here is an example for groff
##
237
# syntax "groff" "\.m[ems]$" "\.tmac$" "^tmac." ".rof"
238
## The argument of .nr or .ds
239
240
# color cyan "^\.ds [^[[:space:]]]*"
# color cyan "^\.nr [^[[:space:]]]*"
241
## Single character escapes
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
242
243
244
245
246
# color brightmagenta "\\."
## Highlight the argument of \f or \s in the same color
# color brightmagenta "\\f."
# color brightmagenta "\\f\(.."
# color brightmagenta "\\s(\+|\-)?[0-9]"
247
## \n
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
248
249
250
# color cyan "(\\|\\\\)n."
# color cyan "(\\|\\\\)n\(.."
# color cyan start="(\\|\\\\)n\[" end="]"
251
## Requests
252
# color brightgreen "^\.[[:space:]]*[^[[:space:]]]*"
253
## Comments
254
# color yellow "^\.\\".*$"
255
## Strings
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
256
257
258
# color green "(\\|\\\\)\*."
# color green "(\\|\\\\)\*\(.."
# color green start="(\\|\\\\)\*\[" end="]"
259
## Characters
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
260
261
# color brightred "\\\(.."
# color brightred start="\\\[" end="]"
262
## Macro arguments
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
263
264
265
266
267
# color brightcyan "\\\\\$[1-9]"

## Here is an example for perl
##
# syntax "perl" "\.p[lm]$"
268
# 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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# 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)\>"
# color cyan start="[$@%]" end="( |\\W|-)"
# color yellow "".*"|qq\|.*\|"
# color white "[sm]/.*/"
# color white start="(^use| = new)" end=";"
# color green "#.*"
# color yellow start="<< 'STOP'" end="STOP"

## Here is an example for Java source
##
# 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)\>"
283
# color red ""[^"]*""
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
284
285
286
287
# color yellow "\<(true|false|null)\>"
# color blue "//.*"
# color blue start="/\*" end="\*/"
# color brightblue start="/\*\*" end="\*/"
288
# color brightgreen,green "[[:space:]]+$"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
289

290
291
292
293
294
295
296
297
298
299
300
## 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.*"

301
302
303
304
305
306
307
## 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)"
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
308
# color brightwhite "\\f[BIPR]"
309
310
# color yellow "\.(br|DS|RS|RE|PD)"

311
312
313
314
315
316
317
## Here is an example for assembler
##
# 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)"
318
# icolor brightred "^[[:space:]]*[._A-Z0-9]*:"
319
320
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
## Highlight strings (note: VERY resource intensive)
321
322
# color brightyellow "<[^= 	]*>" ""(\\.|[^"])*""
# color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
323
324
325
326
## Highlight comments
# color brightblue "//.*"
# color brightblue start="/\*" end="\*/"

327
328
329
330
331
332
## Here is an example for Bourne shell scripts
##
# syntax "shellscript" "\.sh$"
# icolor brightgreen "^[_A-Z0-9]+\(\)"
# 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 "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
333
# color green "-[Ldefgruwx]\>"
334
335
336
337
# 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)\>"
# icolor brightred "\$\{?[_A-Z0-9]+\}?"
# color yellow "#.*$"
338
# color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
339

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
340
341
## Here is an example for your .nanorc
##
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
342
# syntax "nanorc" "(\.|/|)nanorc$"
343
## highlight possible errors and parameters
344
# icolor brightwhite "^[[:space:]]*(set|unset|syntax|i?color).*$"
345
## set, unset and syntax
346
# icolor cyan "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct|quickblank)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace|wordbounds)\>"
347
# icolor green "^[[:space:]]*(set|unset|syntax)\>"
348
## colors
349
# icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
350
# icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
351
## strings
352
# icolor white ""(\\.|[^"])*""
353
## comments
354
# icolor blue "^[[:space:]]*#.*$"