nanorc.sample 7.53 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

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
17
## Constantly display the cursor position in the status bar.
18
19
# set const

20
## Use cut to end of line with ^K by default
21
22
# set cut

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
23
24
25
26
27
28
29
30
## Set the line length for wrapping text and justifying paragraphs.
## If fill is negative, the line length will be the screen width less
## this number.
##
# set fill -8

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

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
32
## Allow multiple file buffers (using ^R inserts into separate buffer).
33
## You must have configured with --enable-multibuffer or --enable-extra
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
34
## for this to work.
35
36
##
## set multibuffer
37

38
## Don't convert files from DOS/Mac format
39
# set noconvert
40

41
## Don't follow symlinks when writing files
42
43
# set nofollow

44
## Don't display the help lists at the bottom of the screen
45
46
# set nohelp

47
## Don't wrap text at all
48
49
# set nowrap

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
50
51
52
53
54
55
## 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 ""
56

57
58
## Preserve the XON and XOFF keys (^Q and ^S)
# set preserve
59

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
60
61
62
63
64
65
## 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 "> "
66
## You can get old nano quoted-justify behavior via:
Chris Allegretta's avatar
Chris Allegretta committed
67
# set quotestr "(> )+"
68

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
69
70
71
## Fix Backspace if it acts like Delete
# set rebinddelete

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
72
## Do extended regular expression searches by default 
73
74
# set regexp

75
## Use smooth scrolling as the default
76
# set smooth
77

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
78
79
80
81
## Use this spelling checker instead of the internal one.  This option
## does not properly have a default value.
##
# set speller "aspell -c"
82

83
## Allow nano to be suspended with ^Z
84
85
# set suspend

86
## Use this tab size instead of the default; it must be greater than 0
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
87
# set tabsize 8
88

89
## Save automatically on exit, don't prompt
90
# set tempfile
91

92
## Disallow file modification, why would you want this in an rc file? ;)
93
# set view
94

95
## Color setup
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
96
## Format:
97
98
99
## syntax "short description" ["filename regex" ...]
## color foreground,background "regex" ["regex"...]
##
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
100
101
## Legal colors: white, black, red, blue, green, yellow, magenta, cyan.
## You may use the prefix "bright" to mean a stronger color highlight.
102
103
104
105
106
107
##
## To use multi-line regexes use the start="regex" end="regex" format.
##
## 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
108
109
##
# syntax "c-file" "\.(c|h)$"
110
# color red "\<[A-Z_]{2,}\>" 
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
111
112
113
114
# color green "\<(float|char|int|void|static|const|struct)\>" 
# color brightyellow "\<(if|while|do|else|case|switch)\>"
# color brightcyan "^#( 	)*(define|include|ifn?def|endif|elif|else|if)" 
##
115
116
## 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
117
118
119
120
## are read in.
##
# color brightyellow "<[^= 	]*>" ""(\\.|[^\"])*""
##
121
## This string is VERY resource intensive!!!
122
# color brightyellow start=""(\\.|[^\"])*\\( |	)*$" end="^(\\.|[^\"])*""
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
123
##
124
## And we want to have some nice comment highlighting too
125
# color brightblue "//.*"
Chris Allegretta's avatar
Chris Allegretta committed
126
# color brightblue start="/\*" end="\*/"
127

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
128
## Here is a short example for HTML
129
130
# syntax "HTML" "\.html$"
# color blue start="<" end=">"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
131
132
133
# color red "&[^; 	]*;"

## Here is a short example for TeX files
134
# syntax "TeX" "\.tex$"
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
135
136
# color green "\\.|\\[A-Za-z]*"
# color magenta "[{}]"
137
138
# color blue "%.*"

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
139
## Here is an example for quoted emails (under e.g. mutt)
140
141
# syntax "mutt"
# color green "^>.*"
142

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
143
144
145
## Here is an example for groff
##
# syntax "groff" "\.ms$" "\.mm$" "\.me$" "\.tmac$" "^tmac." ".rof"
146
## The argument of .nr or .ds
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
147
148
# color cyan "^\.ds [^ ]*"
# color cyan "^\.nr [^ ]*"
149
## Single character escapes
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
150
151
152
153
154
# color brightmagenta "\\."
## Highlight the argument of \f or \s in the same color
# color brightmagenta "\\f."
# color brightmagenta "\\f\(.."
# color brightmagenta "\\s(\+|\-)?[0-9]"
155
## \n
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
156
157
158
# color cyan "(\\|\\\\)n."
# color cyan "(\\|\\\\)n\(.."
# color cyan start="(\\|\\\\)n\[" end="]"
159
## Requests
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
160
# color brightgreen "^\. *[^ ]*"
161
## Comments
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
162
# color yellow "^\.\\\".*$"
163
## Strings
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
164
165
166
# color green "(\\|\\\\)\*."
# color green "(\\|\\\\)\*\(.."
# color green start="(\\|\\\\)\*\[" end="]"
167
## Characters
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
168
169
# color brightred "\\\(.."
# color brightred start="\\\[" end="]"
170
## Macro arguments
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# color brightcyan "\\\\\$[1-9]"

## Here is an example for perl
##
# syntax "perl" "\.p[lm]$"
# 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|seekdir|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)\>"
# 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="\*/"
# color brightgreen,brightgreen "[ 	]+$"

## Here is an example for your .nanorc
##
# syntax "nanorc" "[\.]*nanorc$"
# color white "^ *(set|unset).*$"
# color cyan "^ *(set|unset) (autoindent|backup|const|cut|fill|keypad|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|quotestr|regexp|smooth|speller|suspend|tabsize|tempfile|historylog|view)"
# color brightwhite "^ *syntax [^ ]*"
# color brightblue "^ *set\>" "^ *unset\>" "^ *syntax\>"
# color white "^ *color\>.*"
# color yellow "^ *color (bright)?(white|black|red|blue|green|yellow|magenta|cyan)\>"
# color magenta "^ *color\>"
# color green "^#.*$"