# [TIP] nanorc, ovvero nano colorato come vim

## FonderiaDigitale

mettete questo file in /etc/nanorc per avere i vostri file colorati a schermo come in vi.

nano distingue il tipo di file dall'estensione, per cui attenzione, che script.sh non verra' visualizzato come script

Nano sara' leggermente piu lento con questo file.. ma niente di visibile in un p3 800mhz.

ps. mi scuso se il file va oltre lo schermo  :Smile: 

cips.

```
set autoindent

## Backup files to filename~

# set backup

## The directory to put the backup files in.

# set backupdir ""

## 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

## 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 "(> )+"

## Fix Backspace/Delete confusion problem

# set rebinddelete

## 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"

## 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 8

## Save automatically on exit, don't prompt

# set tempfile

## Disallow file modification, why would you want this in an rc file? ;)

# set view

## Color setup

## Format:

## syntax "short description" ["filename regex" ...]

## color foreground,background "regex" ["regex"...]

##

## Legal colors: white, black, red, blue, green, yellow, magenta, cyan.

## You may use the prefix "bright" to mean a stronger color highlight.

##

## 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.

##

## 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.

##

## Here is a short example for HTML

syntax "HTML" "\.html$"

color blue start="<" end=">"

color red "&[^; ]*;"

## Here is a short example for TeX files

syntax "TeX" "\.tex$"

color green "\\.|\\[A-Za-z]*"

color magenta "[{}]"

color blue "%.*"

## Here is an example for quoted emails (under e.g. mutt)

syntax "mutt"

color green "^>.*"

## Here is an example for groff

##

syntax "groff" "\.ms$" "\.mm$" "\.me$" "\.tmac$" "^tmac." ".rof"

# The argument of .nr or .ds

 color cyan "^\.ds [^ ]*"

 color cyan "^\.nr [^ ]*"

# Single character escapes

 color brightmagenta "\\."

# Highlight the argument of \f or \s in the same color

 color brightmagenta "\\f."

 color brightmagenta "\\f\(.."

 color brightmagenta "\\s(\+|\-)?[0-9]"

## \n

 color cyan "(\\|\\\\)n."

 color cyan "(\\|\\\\)n\(.."

 color cyan start="(\\|\\\\)n\[" end="]"

# Requests

 color brightgreen "^\. *[^ ]*"

## Comments

 color yellow "^\.\\\".*$"

## Strings

 color green "(\\|\\\\)\*."

 color green "(\\|\\\\)\*\(.."

 color green start="(\\|\\\\)\*\[" end="]"

## Characters

 color brightred "\\\(.."

 color brightred start="\\\[" end="]"

## Macro arguments

 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,green " +$"

## Here is an example for your .nanorc

##

syntax "nanorc" "(\.|/|)nanorc$"

## highlight possible errors and parameters

color brightwhite "^ *(set|unset|syntax|color).*$"

## set, unset and syntax

color cyan "^ *(set|unset) +(autoindent|backup|const|cut|fill|historylog|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|quotestr|rebinddelete|regexp|smooth|speller|suspend|tabsize|tempfile|view)"

color green "^ *(set|unset|syntax)\>"

## colors

color yellow "^ *color +(bright)?(white|black|red|blue|green|yellow|magenta|cyan)(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"

color magenta "^ *color\>" "\<(start|end)="

# strings

color white "\"(\\.|[^\"])*\""

## comments

color blue "^ *#.*$"

## Here is an example for ebuilds/eclasses

##

 syntax "ebuild" "\.e(build|class)$"

## All the standard portage functions

 color brightgreen "^src_(unpack|compile|install)" "^pkg_(config|nofetch|setup|(pre|post)(inst|rm))"

## Highlight bash related syntax

 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 "-(e|d|f|r|g|u|w|x|L)\>"

 color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"

## Highlight variables ... official portage ones in red, all others in bright red

 color brightred "\$\{?[a-zA-Z_0-9]+\}?"

 color red "\<(ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|FILESDIR|WORKDIR|(P|R)?DEPEND|PROVIDE|DISTDIR|RESTRICT)\>"

 color red "\<(S|D|T|PV|PF|P|PN|A)\>" "\<C(XX)?FLAGS\>"

## Highlight portage commands

 color magenta "\<use(_(with|enable))?\> [a-z0-9X ]*" "inherit.*"

 color brightblue "e(begin|end|conf|install|make|warn|infon?|error|patch)"

 color brightblue "\<die\>" "\<use(_(with|enable))?\>" "\<inherit\>" "\<has\>" "\<(has|best)_version\>" "\<unpack\>"

 color brightblue "\<(do|new)(ins|s?bin|doc|lib(|\.so|\.a)|man|info|exe)\>"

 color brightblue "\<do(python|sed|dir|hard|sym|html|jar|mo)\>" "\<keepdir\>" 

 color brightblue "prepall(|docs|info|man|strip)" "prep(info|lib|lib\.so|man|strip)"

 color brightblue "\<(|doc|ins|exe)into\>" "\<f(owners|perms)\>" "\<(exe|ins|dir)opts\>"

## Highlight common commands used in ebuilds

 color blue "\<make\>" "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|let|ln|mkdir|mv|rm|sed|set|tar|touch|unset)\>"

## Highlight comments (doesnt work that well)

 color yellow "#.*$"

## Highlight strings (doesnt work that well)

 color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'"

## manpages

#

 syntax "manpage" "\.[1-9]$"

 color green "\.(S|T)H.*$"

 color brightgreen "\.(S|T)H" "\.TP"

 color brightred "\.(BR?|IP?).*$"

 color brightblue "\.(BR?|IP?|PP)"

 color brightwhite start="\\fI" end="\\fR"

 color brightwhite start="\\fB" end="\\fR"

 color yellow "\.(br|DS|RS|RE|PD)"

## 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 shell scripts

##

 syntax "shellscript" "\.sh$"

 color brightgreen "^[a-zA-Z_0-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 "-(e|d|f|r|g|u|w|x|L)\>"

 color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"

 color brightblue "\<make\>" "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|mkdir|mv|rm|sed|set|tar|touch|umask|unset)\>"

 color brightred "\$\{?[a-zA-Z_0-9]+\}?"

 color yellow "#.*$"

 color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'"

syntax "php" ".php"

color brightblue "(.*)\("

color blue "\$[a-zA-Z_0-9$]*|=*|=*|<|>|!"

color green "(var|class|function|echo|case|break|default|exit|switch|if|else|elseif|@|while) "

color green "[.,{}();]"

color red "('.*')|(\".*\")"

color brightyellow "#.*|//.*"

color brightyellow start="/\*" end="\*/"

color brightblue "(<\?php|\?>)"

syntax "python" "\.py$"

color brightblue "def [a-zA-Z_0-9]+"

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)\>"

color brightgreen "([\"']).*?[^\\]\1"

color brightgreen start="\"\"\"" end="\"\"\""

color brightred "#.*$" 

##############################################################################

#

# Syntax highlighting for mails

#

# Author:  Josef 'Jupp' Schugt, jupp(a)rubyforge.org

# License: GPL 2  or later

#

# Version: 2004-02-25

#

##############################################################################

syntax "mail"

# Different quotation levels

color yellow  "^(> ?> ?> ?> ?> ?)*> ?> ?> ?> ?> ?([^>][^>].*|$)"

color magenta "^(> ?> ?> ?> ?> ?)*> ?> ?> ?> ?([^>][^>].*|$)"

color cyan    "^(> ?> ?> ?> ?> ?)*> ?> ?> ?([^>][^>].*|$)"

color red     "^(> ?> ?> ?> ?> ?)*> ?> ?([^>][^>].*|$)"

color green   "^(> ?> ?> ?> ?> ?)*> ?([^>][^>].*|$)"

# Different header fields

color brightgreen   "^(From|Reply-To): .*"

color brightyellow  "^(To|Cc|Bcc): .*"

color brightred     "^Subject: .*"

color cyan          "^(In-Reply-To|References): .*"

color red           "^Organi(s|z)ation: .*"

color magenta       "^(X-Mailer|(X-)?User-Agent): .*"

color yellow        "X-(Accept-Language|GPG-Fingerprint|Location): .*"

color yellow        "X-(Spamfilter): .*"

# urls

color brightyellow "\<(finger|ftp|gopher|https?|news|telnet|tn3270)://[^ >)]*"

color brightyellow "\<mailto:[^ >)]*"

# bold

color brightgreen  "\*+[^*]+\*+"

# underlined

color brightcyan   "_+[^*]+_+"

##############################################################################

#

# Syntax highlighting for C files

#

# Author:  Josef 'Jupp' Schugt, jupp(a)rubyforge.org

# License: GPL 2  or later

#

# Version: 2004-02-25

#

##############################################################################

syntax "c-file" "\.(c|h)$"

# Default

color white "^.+$"

# Trigraphs

color brightyellow "\?\?[-=(\\)'<!>]"

# Decimal, cotal and hexadecimal numbers

color red "\<[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\>"

# Floating point number with at least one digit before decimal point

color red "\<[-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"

color red "\<[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"

# Keywords

color brightyellow "\<(break|case|continue|default|do|else|for|goto|if)\>"

color brightyellow "\<(inline|return|sizeof|switch|typedef|while)\>"

# Storage classes

color cyan "\<(auto|register|static|extern)\>"

# Type qualifiers

color cyan "\<(const|restrict|volatile)\>"

# Enumerations, structs, and unions

color cyan "\<(enum|struct|union)\>"

# Type specifiers

color cyan "\<(char|double|float|int|long|short|(un)?signed|void)\>"

color cyan "\<(_(Bool|Complex|Imaginary)|FILE|va_list|wc(trans|type)_t)\>"

color cyan "\<(u?int((_fast|_least)?(8|16|32|64)|max|ptr)|w(char|int))_t|\>"

# Preprocessor directives: Conditions

color red "^[ \t]*#(ifn?def|else|endif)\>"

color red "^[ \t]*#(if|elif)[ \t]*!?[ \t]*(defined)?\>"

# Preprocessor directive: Set line number

color yellow "^[ \t]*#line\>.*$"

color red    "^[ \t]*#line\>"

# Preprocessor: Issue error message

color yellow "^[ \t]*#error\>.*$"

color red    "^[ \t]*#error\>"

# Preprocessor: Pragma (don't ask :-)

color yellow "^[ \t]*#pragma\>.*$"

color red    "^[ \t]*#pragma\>"

# Preprocessor: Predefined macros

color red "__(LINE|FILE|func|DATE|TIME|STD(C|_HOSTED|_VERSION))__"

# Preprocessor directives: Definition

color red "^[ \t]*#(define|undef)\>"

# Preprocessor directive: File inclusion

color yellow "^[ \t]*#include[ \t]*(\"[^"]*\"|<[^>]*>)"

color red    "^[ \t]*#include\>"

# String

color yellow "L?\"(\\"|[^"])*\""

color yellow "L?'(\'|[^'])*'"

# Escapes

color red "\\[0-7][0-7]?[0-7]?|\\x[0-9a-fA-F]+|\\[abfnrtv'"\?\\]"

# Comments

color magenta start="/\*" end="\*/"

color magenta "//.*$"

##############################################################################

#

# Ruby syntax highlighting for Nano.

#

# Author:  Josef 'Jupp' Schugt, jupp(a)rubyforge.org

# License: GPL 2  or later

#

# Version: 2004-02-27

#

##############################################################################

# Automatically use for '.rb' files

syntax "ruby" ".*\.*rb$"

# General

color white ".+"

# Operators

color brightyellow "::|\*\*|!|~|\*|/|%|\+|-|&|<<|>>|\|\^|>|>=|<|<=|<=>|\|\||!=|=~|!~|&&|\+=|-=|=|\.\.|\.\.\.|\<(not|and|or)\>"

# Keywords

color brightyellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined|do|else|elsif|end|ensure|for|if|in|module)\>"

color brightyellow "\<(next|not|or|redo|rescue|retry|return|self|super|then|undef|unless|until|when|while|yield)\>"

# false, nil, true

color magenta "\<(false|nil|true)\>"

# Above must not match 'nil?'

color white "\<nil\?"

# external stuff

color brightgreen "(\<(load|require|include)|%q|%!|%Q|%r|%x)\>"

# Iterators

color brightgreen "\|\w+(,[ \t]*\w+)*\|"

# Constants

color yellow "\<[A-Z]\w*\>"

# Variables starting with '$', '@' or '@@'

color white "(\$|@@?)\w+\>"

# Function names ending in '!' or '?'

color white "\w+(!|\?)"

# Symbols

color yellow "([ \t]|^):(@|@@|\$)?\w+\>"

# Strings

color green "\"(\\.|[^\\\"])*\"|'(\\.|[^\\'])*'"

# Backticks

color green "`(\\.|[^\\\"])*`"

# Regular expressions

color green "/(\\.|[^\\/])*/[imox]*"

# Escapes

color red "\\[0-7][0-7][0-7]|\\x[0-9a-fA-F][0-9a-fA-F]|\\[abefnrs]|(\\c|\\C-|\\M-|\\M-\\C-)."

# Expression substitution

color red "#\{[^}]*\}|#[@$]\w+"

# Simple comments

color cyan         "#([^{$@].*)?$"

# Shebang

color brightcyan   "^#!.*"

# Multiline comments

color cyan         start="^=begin" end="^=end"

##############################################################################

#

# Syntax highlighting for XML files

#

# Author:  Josef 'Jupp' Schugt, jupp(a)rubyforge.org

# License: GPL 2  or later

#

# Version: 2004-02-25

#

##############################################################################

syntax "ml" ".*\.([jrs]?html?|xml|sgml?)$"

color white "^.+$"

color green  start="<" end=">"

color cyan   "<[^> ]+"

color cyan   ">"

color yellow start="<!DOCTYPE" end="[/]?>"

color yellow start="<!--" end="-->"

color red    "&[^;]*;"

##############################################################################

#

# Syntax highlighting for HTTP codes

#

# Author:  Josef 'Jupp' Schugt, jupp(a)rubyforge.org

# License: GPL 2  or later

#

# Version: 2004-02-25

#

##############################################################################

syntax "urls"

color brightmagenta   "^.*$"

color cyan      "^(1[0-9][0-9]|20[256]|30[45]).*$"

color green      "^20[03].*$"

color brightyellow   "^(201|30[0-37]).*$"

color brightred      "^(204|[45][0-9][0-9]|666).*$"

##############################################################################

#

# Syntax highlighting for gentoo config files

#

# Author:  Luca Marturana, lucamarturana(a)gmail.com

# License: GPL 2  or later

#

# Version: 2006-04-09

#

##############################################################################

syntax "config-bash-style" "conf.d|env.d"

color white ""(\\.|[^\"])*"" "'(\\.|[^'])*'"

color red "\{?[_A-Z0-9]+\}?="

color blue "#.*$"

syntax "make.conf" "make.conf"

color brightblue "USE=\".*\""

color brightred "[ |\"]-[^ ]*"

color white "^[^U].*"

color red "\{?[_A-Z0-9]+\}?="

color blue "#.*$"

syntax "package.use" "package.use"

color brightblue ".*"

color brightred " -[^ ]*"

color white "[^ ]*/[^ ]*"

color brightyellow "^(>|<|=|<=|>=|~)"

color yellow "#.*$"

syntax "package.keywords" "package.keywords"

color red "-[^ ]*"

color blue "~[^ ]*"

color white "[^ ]*/[^ ]*"

color brightyellow "^(>|<|=|<=|>=|~)"

color yellow "#.*$"

syntax "package.mask-unmask" "package.(mask|unmask)"

color white "[^ ]*/[^ ]*"

color brightyellow "^(>|<|=|<=|>=|~)"

color yellow "#.*$" 

```

// edit:

2006-04-09: aggiunto Syntax highlighting for gentoo config files -- lavish

----------

## fedeliallalinea

Tip award  :Cool: 

----------

## Cagnulein

attenzione quando copiate, che tutto sia come da codice di Fonderia  :Smile: 

----------

## doom.it

mitico  :Wink: 

----------

## marco86

spettacolo, anche su un PII 350 perdi al max un secondo....

MITICO!  :Surprised: 

----------

## federico

Se riesci a perdere un secondo con sta cosa il tuo pc perde colpi  :Smile: 

----------

## .:deadhead:.

Spettacolo davvero  :Very Happy:  grazie Fonderia!

----------

## Sbriglie

Meraviglioso! 

 :Razz: 

----------

## Tiro

MITICO!  :Smile: 

----------

## RenfildDust

E adesso chi passerà più a vim.. 

Cmq bisogna cancellare qualche \n per farlo funzionare correttamente..

Veramente bello!

----------

## paperp

Non riesco a capire ho copiato utto per benino da fonderia , ma l'unico file aperto con Nano che mi venga colorato è solo quello di configurazione----> /etc/nanorc     :Sad: 

Gli altri rimangono uguali...griiiggi!!

Perchè??  :Crying or Very sad: 

----------

## fedeliallalinea

Che file hai aperto (che estensione)?

----------

## paperp

..roba tipo /etc/X11/xorgconf oppure /etc/X11/xloadimagerc...dove cappello??

Ciao fede e buona Domenica.

----------

## fedeliallalinea

@paperp

 *FonderiaDigitale wrote:*   

> nano distingue il tipo di file dall'estensione, per cui attenzione, che script.sh non verra' visualizzato come script

 

----------

## paperp

...ovvero..cosa vuol dire , come faccio a visulaizzare in maniera corretta colorata un file dipo bashrc??

----------

## fedeliallalinea

 *paperp wrote:*   

> ...ovvero..cosa vuol dire , come faccio a visulaizzare in maniera corretta colorata un file dipo bashrc??

 

Non penso che puoi visto che per la colorazione si basa sull'estensione del file e bashrc non ha nessuna estensione

----------

## paperp

..forse ho capito , voui dire che se aproun file di testo tipo .txt o .doc lo visulaizza coloato..giusto??!!

Avolte ci arrivo anch'io  :Laughing: 

----------

## FonderiaDigitale

nano riconosce i file e fa la colorazione sintattica basandosi sull'estensione del file. un file senza estensione non viene colorato.

se e' un file che apri frequentemente, e non lo puoi rinominare (per vari motivi) io ti consiglio di fare un link simbolico al file+estensione nella stessa dir, ad es. 

```
cd /dir

ln -s ciccio ciccio.sh

nano ciccio.sh

```

----------

## VegetaSSJ5

ho un problema

lanciando nano filename mi dice

```
localhost ~ # nano /etc/nanorc

Errore in /etc/nanorc alla riga 570: L'espressione regolare deve iniziare e finire con il carattere "

Premere Invio per continuare l'avvio di nano
```

nella riga 570 (che per capirci è l'ultima riga del file) c'è la regola color brightred "^(204|[45][0-9][0-9]|666).*$" infatti commentando questa riga non mi dà nessun errore. però mi sembra che sia scritta bene, qual'è il problema?

----------

## koma

quando hai copiato il testo ha mandato a capo le linee....

fai così

```
#cd /etc

#mv nanorc nanorc.old

#wget http://www.etilico.it/pub/nanorc

```

----------

## Luca89

Per chi non lo sapesse, nano permette di evidenziare la sintassi dei file che modifichiamo tramite un sistema di espressioni regolari, ecco qualche riga da aggiungere al nanorc per ottentere l'evidenziazione della sintassi per alcuni file di sistema come make.conf, /etc/portage/package.*, /etc/conf.d/* etc:

```
syntax "config-bash-style" "conf.d|env.d"

color white ""(\\.|[^\"])*"" "'(\\.|[^'])*'"

color red "\{?[_A-Z0-9]+\}?="

color blue "#.*$"

syntax "make.conf" "make.conf"

color brightblue "USE=\".*\""

color brightred "[ |\"]-[^ ]*"

color white "^[^U].*"

color red "\{?[_A-Z0-9]+\}?="

color blue "#.*$"

syntax "package.use" "package.use"

color brightblue ".*"

color brightred " -[^ ]*"

color white "[^ ]*/[^ ]*"

color brightyellow "^(>|<|=|<=|>=|~)"

color yellow "#.*$"

syntax "package.keywords" "package.keywords"

color red "-[^ ]*"

color blue "~[^ ]*"

color white "[^ ]*/[^ ]*"

color brightyellow "^(>|<|=|<=|>=|~)"

color yellow "#.*$"

syntax "package.mask-unmask" "package.(mask|unmask)"

color white "[^ ]*/[^ ]*"

color brightyellow "^(>|<|=|<=|>=|~)"

color yellow "#.*$"

```

Queste righe vanno aggiunte alla fine del file /etc/nanorc oppure nel file ~/.nanorc. Il risultato è qualcosa di simile a questo.

[EDIT] Scusatemi, ho visto ora questo topic, se i moderatori lo ritengono opportuno si potrebbe accodare il mio post li, magari sarebbe anche meglio contattare fonderiadigitale per aggiungere le mie highlighting nel suo post.

----------

## lavish

Ciao Luca89, ho fatto il thread delle due discussioni intanto  :Wink: 

//EDIT:

Ho aggiunto su autorizzazione di Fonderia Digitale Syntax highlighting for gentoo config files di Luca89

Grazie mille  :Smile: 

----------

## Onip

molto bello, grazie a tutti!

----------

## bandreabis

1.3.12-r1 ha portato cambiamenti in /etc/nanorc.

Come ci si comporta? Con il nuovo file naturalmente non si hanno più i colori.

----------

## Luca89

Alla fine del file /etc/nanorc ci sono delle righe commentate che cominciano per "include", decommentale per attivare la rispettiva colorazione.

----------

## bandreabis

Che dire... Grazie!

E grazie al mitico fonderia per il tip!

PS. ma un giorno ci vieni ad un GentooPub a Milano?  :Very Happy: 

Andrea

----------

