nanorc.sample 12.2 KB
Newer Older
1
## Sample initialization file for GNU nano
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
2
3
4
## 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.
5
6
##
## To make sure a value is not enabled, use "unset <option>"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
7
8
9
##
## For the options that take parameters, the default value is given.
## Other options are unset by default.
10

11
## Use auto-indentation.
12
13
# set autoindent

14
## Backup files to filename~.
15
# set backup
16

17
## The directory to put unique backup files in.
18
19
# set backupdir ""

20
21
22
## Do backwards searches by default.
# set backwards

23
24
25
## The characters treated as closing brackets.  They cannot contain
## blank characters.  Only closing punctuation, optionally followed by
## closing brackets, can end sentences.
26
27
28
##
# set brackets "'")}]>"

29
30
31
## Do case sensitive searches by default.
# set casesensitive

32
33
## Constantly display the cursor position in the statusbar.  Note that
## this cancels out "quickblank".
34
35
# set const

36
## Use cut to end of line by default.
37
38
# set cut

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
39
## Set the line length for wrapping text and justifying paragraphs.
40
## If fill is 0 or less, the line length will be the screen width less
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
41
42
43
44
45
46
## this number.
##
# set fill -8

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

48
49
50
51
52
## 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.
53
54
# set mouse

55
56
## Allow multiple file buffers (inserting a file will put it into a
## separate buffer).  You must have configured with --enable-multibuffer
57
## for this to work.
58
##
59
# set multibuffer
60

61
## Don't convert files from DOS/Mac format.
62
# set noconvert
63

64
## Don't follow symlinks when writing files.
65
66
# set nofollow

67
## Don't display the helpful shortcut lists at the bottom of the screen.
68
69
# set nohelp

70
## Don't wrap text at all.
71
72
# set nowrap

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
73
74
75
76
77
78
## 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 ""
79

80
## Preserve the XON and XOFF keys (^Q and ^S).
81
# set preserve
82

83
## The characters treated as closing punctuation.  They cannot contain
84
## blank characters.  Only closing punctuation, optionally followed by
85
86
87
88
## closing brackets, can end sentences.
##
# set punct ".?!"

89
## Do quick statusbar blanking.  Statusbar messages will disappear after
90
## 1 keystroke instead of 25.  Note that "const" cancels this out.
91
92
93
##
# set quickblank

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
94
95
96
97
98
99
## 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:
# set quotestr "^([ 	]*[\|>:}#])+"
## if you have regexps, otherwise:
# set quotestr "> "
100
## You can get old nano quoted-justify behavior via:
Chris Allegretta's avatar
Chris Allegretta committed
101
# set quotestr "(> )+"
102

103
## Fix Backspace/Delete confusion problem.
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
104
105
# set rebinddelete

106
107
108
## Do extended regular expression searches by default.
# set regexp

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
109
110
111
112
113
114
115
## 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

116
## Use smooth scrolling as the default.
117
# set smooth
118

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
119
120
121
## Use this spelling checker instead of the internal one.  This option
## does not properly have a default value.
##
122
# set speller "aspell -x -c"
123

124
## Allow nano to be suspended.
125
126
# set suspend

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

130
131
132
## Convert typed tabs to spaces.
# set tabstospaces

133
## Save automatically on exit, don't prompt.
134
# set tempfile
135

136
## Disallow file modification; why would you want this in an rcfile? ;)
137
# set view
138

139
140
141
## 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.
142
143
# set whitespace "  "

144
## Color setup
145
##
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
146
## Format:
147
##
148
## syntax "short description" ["filename regex" ...]
149
##
150
## color foreground,background "regex" ["regex"...]
151
152
153
154
155
## or
## icolor foreground,background "regex" ["regex"...]
##
## "color" will do case sensitive matches, while "icolor" will do case
## insensitive matches.
156
##
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
157
## Legal colors: white, black, red, blue, green, yellow, magenta, cyan.
158
159
## You may use the prefix "bright" to mean a stronger color highlight
## for the foreground.
160
##
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
161
## To use multi-line regexes, use the start="regex" end="regex" format.
162
##
163
164
165
## 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
166
##
167
# syntax "c-file" "\.(c|C|cc|cpp|cxx|h|H|hh|hpp|hxx)$"
168
# color red "\<[A-Z_]{2,}\>" 
169
170
# color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>"
# color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\>"
171
172
# color brightyellow "\<(for|if|while|do|else|case|default|switch|goto|continue|break|return)\>"
# color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
173
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
174
# color brightmagenta "'([^\]|(\\['abfnrtv\\]))'" "'\\(([0-7][0-7]?)|([0-3][0-7][0-7]))'" "'\\x[0-9A-Fa-f][0-9A-Fa-f]?'"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
175
##
176
177
178
179
## GCC builtins
##
# color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(asm|builtin|inline|restrict|typeof)__"
##
180
181
## 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
182
183
## are read in.
##
184
# color brightyellow "<[^= 	]*>" ""(\\.|[^\"])*""
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
185
##
186
## This string is VERY resource intensive!!!
187
# color brightyellow start=""(\\.|[^\"])*\\[[:space:]]*$" end="^(\\.|[^\"])*""
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
188
##
189
## And we want to have some nice comment highlighting too
190
# color brightblue "//.*"
Chris Allegretta's avatar
Chris Allegretta committed
191
# color brightblue start="/\*" end="\*/"
192

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
193
## Here is a short example for HTML
194
195
# syntax "HTML" "\.html$"
# color blue start="<" end=">"
196
# color red "&[^;[[:space:]]]*;"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
197
198

## Here is a short example for TeX files
199
# syntax "TeX" "\.tex$"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
200
201
# color green "\\.|\\[A-Za-z]*"
# color magenta "[{}]"
202
203
# color blue "%.*"

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
204
## Here is an example for quoted emails (under e.g. mutt)
205
206
# syntax "mutt"
# color green "^>.*"
207

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
208
209
## Here is an example for groff
##
210
# syntax "groff" "\.m[ems]$" "\.tmac$" "^tmac." ".rof"
211
## The argument of .nr or .ds
212
213
# color cyan "^\.ds [^[[:space:]]]*"
# color cyan "^\.nr [^[[:space:]]]*"
214
## Single character escapes
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
215
216
217
218
219
# color brightmagenta "\\."
## Highlight the argument of \f or \s in the same color
# color brightmagenta "\\f."
# color brightmagenta "\\f\(.."
# color brightmagenta "\\s(\+|\-)?[0-9]"
220
## \n
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
221
222
223
# color cyan "(\\|\\\\)n."
# color cyan "(\\|\\\\)n\(.."
# color cyan start="(\\|\\\\)n\[" end="]"
224
## Requests
225
# color brightgreen "^\.[[:space:]]*[^[[:space:]]]*"
226
## Comments
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
227
# color yellow "^\.\\\".*$"
228
## Strings
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
229
230
231
# color green "(\\|\\\\)\*."
# color green "(\\|\\\\)\*\(.."
# color green start="(\\|\\\\)\*\[" end="]"
232
## Characters
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
233
234
# color brightred "\\\(.."
# color brightred start="\\\[" end="]"
235
## Macro arguments
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
236
237
238
239
240
# color brightcyan "\\\\\$[1-9]"

## Here is an example for perl
##
# syntax "perl" "\.p[lm]$"
241
# 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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# 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)\>"
# color red ""[^\"]*""
# color yellow "\<(true|false|null)\>"
# color blue "//.*"
# color blue start="/\*" end="\*/"
# color brightblue start="/\*\*" end="\*/"
261
# color brightgreen,green "[[:space:]]+$"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
262

263
264
265
266
267
268
269
270
271
272
273
## 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.*"

274
275
276
277
278
279
280
## 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
281
# color brightwhite "\\f[BIPR]"
282
283
# color yellow "\.(br|DS|RS|RE|PD)"

284
285
286
287
288
289
290
## 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)"
291
# icolor brightred "^[[:space:]]*[._A-Z0-9]*:"
292
293
# color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
## Highlight strings (note: VERY resource intensive)
294
# color brightyellow "<[^= 	]*>" ""(\\.|[^\"])*""
295
296
297
298
299
# color brightyellow start=""(\\.|[^\"])*\\[[:space:]]*$" end="^(\\.|[^\"])*""
## Highlight comments
# color brightblue "//.*"
# color brightblue start="/\*" end="\*/"

300
301
302
303
304
305
306
307
308
309
310
311
312
## 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 "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
# color green "-(L|d|e|f|g|r|u|w|x)\>"
# 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 "#.*$"
# color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'"

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
313
314
## Here is an example for your .nanorc
##
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
315
# syntax "nanorc" "(\.|/|)nanorc$"
316
## highlight possible errors and parameters
317
# icolor brightwhite "^[[:space:]]*(set|unset|syntax|i?color).*$"
318
## set, unset and syntax
319
320
# icolor cyan "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|brackets|casesensitive|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quickblank|quotestr|rebinddelete)\>" "^[[:space:]]*(set|unset)[[:space:]]+(regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace)\>"
# icolor green "^[[:space:]]*(set|unset|syntax)\>"
321
## colors
322
# icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
323
# icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
324
## strings
325
# icolor white "\"(\\.|[^\"])*\""
326
## comments
327
# icolor blue "^[[:space:]]*#.*$"