User:Mjb/nano configuration files
From Offset
Jump to navigationJump to searchI often use the text editor nano.
Here are the config files I'm using with it:
- ~/.nanorc – my primary config file, which refers to other files via
include
directives - ~/.nano/ – directory for the included syntax highlighting config files which I have added myself
- ~/.nano/README – my own text file explaining what's in this directory
- ~/.nano/nano-highlight-master – GitHub user serialhex's collection of syntax highlighting config files; see README
- ~/.nano/NANOCONFDIR – manually created symbolic link to directory of syntax highlighting config files which came with nano; see README
- ~/.nano/tcsh-bsd.nanorc – my own syntax highlighting file for tcsh config files (BSD regex syntax)
- ~/.nano/tcsh-gnu.nanorc – my own syntax highlighting config file for tcsh config files (GNU regex syntax)
- ~/.nano/tcsh.nanorc – manually created symbolic link to one of the two files above; see README
~/.nanorc
## Sample initialization file for GNU nano ## 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. ## ## To make sure a value is not enabled, use "unset <option>" ## ## For the options that take parameters, the default value is given. ## Other options are unset by default. ## Make the Home key smarter set smarthome ## Use the blank line below the titlebar as extra editing space. set morespace ## Use auto-indentation set autoindent ## Backup files to filename~ # set backup ## Constantly display the cursor position in the status bar. set const ## Use cut to end of line with ^K by default # set cut ## 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 set fill 78 ## Enable ~/.nano_history for saving and reading search/replace strings. # set historylog ## Allow multiple file buffers (using ^R inserts into separate buffer). ## You must have configured with --enable-multibuffer or --enable-extra ## for this to work. ## ## set multibuffer ## Don't convert files from DOS/Mac format # set noconvert ## Don't follow symlinks when writing files # set nofollow ## Don't display the help lists at the bottom of the screen set nohelp ## Don't wrap text at all #set nowrap ## 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 "" ## Preserve the XON and XOFF keys (^Q and ^S) # set preserve ## 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 "> " ## You can get old nano quoted-justify behavior via: # set quotestr "(> )+" ## Do extended regular expression searches by default set regexp ## Use smooth scrolling as the default set smooth ## Use this spelling checker instead of the internal one. This option ## does not properly have a default value. ## # set speller "aspell -c" ## Treat punctuation characters as part of words set wordbounds ## Allow nano to be suspended with ^Z set suspend ## Use this tab size instead of the default; it must be greater than 0 set tabsize 4 ## Save automatically on exit, don't prompt set tempfile ## Disallow file modification, why would you want this in an rc file? ;) # set view ## Syntax highlighting can really slow things down, but it's so pretty # # The files in /usr/share/nano (Linux) or /usr/local/share/nano (BSD) came with nano. # The files in ~/.nano are mine. ~/.nano/NANOCONFDIR is a symlink to /usr/[local/]share/nano. # The files in ~/.nano/nano-highlight-master are from https://github.com/serialhex/nano-highlight # include "~/.nano/nano-highlight-master/apache2.nanorc" include "~/.nano/nano-highlight-master/css.nanorc" include "~/.nano/nano-highlight-master/emailquote.nanorc" include "~/.nano/nano-highlight-master/html.nanorc" include "~/.nano/nano-highlight-master/ini.nanorc" include "~/.nano/nano-highlight-master/patch.nanorc" # must precede nanorc.nanorc and tcsh.nanorc include "~/.nano/nano-highlight-master/rcfiles-new.nanorc" include "~/.nano/NANOCONFDIR/css.nanorc" # emailquote.nanorc is better than mutt.nanorc #include "~/.nano/NANOCONFDIR/mutt.nanorc" include "~/.nano/NANOCONFDIR/nanorc.nanorc" include "~/.nano/NANOCONFDIR/perl.nanorc" include "~/.nano/NANOCONFDIR/php.nanorc" include "~/.nano/NANOCONFDIR/python.nanorc" include "~/.nano/NANOCONFDIR/sh.nanorc" include "~/.nano/NANOCONFDIR/xml.nanorc" # symlink because it uses system-specific extensions to POSIX extended regex syntax include "~/.nano/tcsh.nanorc" ## I like the way nanorc.nanorc does comment coloring (no green!) syntax "default" icolor brightblue "^[[:space:]]*#.*$" icolor cyan "^[[:space:]]*##.*$"
~/.nano/README
The nano-highlight-master folder is the content of master.zip as downloaded from https://github.com/serialhex/nano-highlight (the "Download ZIP" link). It is just someone's personal collection of nanorc files. NANOCONFDIR is a symlink to the nanorc files that came with nano. On Linux it will normally be /usr/share/nano, and on BSD, /usr/local/share/nano. You have to create this symlink yourself. Once you have it, you can use it in "include" directives in your nanorc file, like this: include "~/.nano/NANOCONFDIR/perl.nanorc" tcsh.nanorc is a symlink to my own nanorc for highlighting tcsh config files (.cshrc or .tcshrc). The symlink is needed because the file uses word boundary symbols which are extensions to POSIX extended regular expressions. These are implemented differently by different regex engines, i.e. [[:<:]] and [[:>:]] in BSD, and \< and \> in GNU.
~/.nano/tcsh-bsd.nanorc
syntax "tcsh" "(\.|/)cshrc$" "\.t?csh$" header "^#!.*/t?csh" # based on https://github.com/serialhex/nano-highlight/blob/master/bash.nanorc ## Control builtins color magenta "[[:<:]](break|breaksw|case|continue|default|else|end|endif|endsw|foreach|goto|if|switch|while)[[:>:]]" ## Builtins color red "[[:<:]](:|@|alias|alloc|bg|bindkey|builtins|cd|chdir|complete|dirs|echo|echotc|eval|exec|exit|fg|filetest|glob|hashstat|history|hup|jobs|kill|limit|log|login|logout|ls-F|nice|nohup|notify|onintr|popd|printenv|pushd|rehash|repeat|sched|set|setenv|settc|setty|shift|source|stop|suspend|telltc|termname|time|umask|unalias|uncomplete|unhash|unlimit|unset|unsetenv|wait|where|which)[[:>:]]" ## Brackets and redirects color yellow "[(){}[;|<>]" color yellow "\]" ## Strings color blue "\"(\\.|[^\"])*\"" color blue "'(\\.|[^\'])*'" ## Variables # NOTE: Keep this section below the Strings section, such that Variables are highlighted inside strings. color cyan start="[$@%]" end="([[:alnum:]]|_)*" ## Comments color brightblue "#.*$"
~/.nano/tcsh-gnu.nanorc
syntax "tcsh" "(\.|/)cshrc$" "\.t?csh$" header "^#!.*/t?csh" # based on https://github.com/serialhex/nano-highlight/blob/master/bash.nanorc ## Control builtins color magenta "\<(break|breaksw|case|continue|default|else|end|endif|endsw|foreach|goto|if|switch|while)\>" ## Builtins color red "\<(:|@|alias|alloc|bg|bindkey|builtins|cd|chdir|complete|dirs|echo|echotc|eval|exec|exit|fg|filetest|glob|hashstat|history|hup|jobs|kill|limit|log|login|logout|ls-F|nice|nohup|notify|onintr|popd|printenv|pushd|rehash|repeat|sched|set|setenv|settc|setty|shift|source|stop|suspend|telltc|termname|time|umask|unalias|uncomplete|unhash|unlimit|unset|unsetenv|wait|where|which)\>" ## Brackets and redirects color yellow "[(){}[;|<>]" color yellow "\]" ## Strings color blue "\"(\\.|[^\"])*\"" color blue "'(\\.|[^\'])*'" ## Variables # NOTE: Keep this section below the Strings section, such that Variables are highlighted inside strings. color cyan start="[$@%]" end="([[:alnum:]]|_)*" ## Comments color brightblue "#.*$"