Linux Inspirations

File .nanorc agar Text Editor nano ada warnanya

Posted on: 7 April, 2007

NanoMungkin rekan linuxer terbiasa atau sudah familiar dengan text editor nano, scripts dibawah ini mungkin adalah sebagai salah satu solusi agar editor kita ada warnanya yang biasanya cuma warna putih saja, nah sekarang kita memcoba menambahkan scripts yang ada dibawah ini ke dalam folder root, caranya simple saja

Copy terlebih dahulu scripts dibawah dan buatlah sebuah file dengan nama .nanorc setelah itu simpanlah pada folder root anda. Setelah itu keluar dari text editor anda, dan silahkan login kembali, sekarang editor nano anda sudah ada warnanya.. selamat mencoba hehe.

############### START COPY ################

# Display cursor position
set const

# Disable word wrap
set nowrap

# Use smooth scrolling
set smooth

# Allow suspend
set suspend

##
 syntax “c-file” “\.(c|h)$”
 color red “\<[A-Z_]{2,}\>”
 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)”
##
## 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.
##
 color brightyellow “<[^= ]*>” “”(
\\.|[^\“])*””
##
## This string is VERY resource intensive!!!
 color brightyellow start=””(
\\.|[^\”])*\\( |)*$” end=”^(\\.|[^\“])*””
##
## And we want to have some nice comment highlighting too
 color brightblue “//.*”
 color brightblue start=”/\*” end=”\*/”


## Here is a short example for HTML
syntax “HTML” “\.html$”
color green start=”<” end=”>”
color red “&[^; ]*;”



## Here is a short example for HTML
syntax “CONF” “\.conf$”
color green start=”<” end=”>”
color green “^#.*$”



syntax “GOO” “\.goo$”
color magenta  “^location.*$”
color brightred   “\[.*\]”
color brightblue  “^filename.*$”
color brightblue  “^description.*$”
color brightblue  “^title.*$”
color green       “#.*$”



## Here is a short example for HTML
syntax “JS” “\.js$”
color brightblue “\<(var|function|try|catch|alert|return|if|else|indexOf|for|true|false)\>”
color brightred “”.*””
color brightred “‘.*'”
color green “//.*$”


## Here is a short example for HTML
syntax “SQL” “\.sql$”
color brightblue “\<(create|select|delete|drop|from|where|count|sum|update|insert|replace|order|by)\>”
color brightred “”.*””
color brightred “‘.*'”
color green “//.*$”


## Here is a short example for HTML
syntax “TPL” “\.tpl$”
color brightblue “\<(title|description|bodytext|id)\>”


syntax “EMAIL” “\.email$”
color brightblue “\<(title|description|bodytext|id)\>”


syntax “FORM” “\.frm$”
color brightblue “\<(title|description|bodytext|id)\>”


syntax “PAGE” “\.pagw$”
color brightblue “\<(title|description|bodytext|id)\>”


color brightred “”.*””
color brightred “‘.*'”
color green “//.*$”



## 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
## Hybrid perl5 / perl6 syntax highlighting
syntax “perl” “\.p[lm]$”
color brightblue “\<(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 brightblue “\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>”
# Perl 6 words
color brightcyan “\<(has|is|class|role|given|when|BUILD|multi|returns|method|submethod|slurp|say|sub)\>”
color brightmagenta start=”[$@%]” end=”( |\\W|-)”
color brightred “”.*”|qq\|.*\|”
color white “[sm]/.*/”
color brightblue start=”(^use| = new)” end=”;”
color brightgreen “#.*”
color brightred start=”<<EOSQL” end=”EOSQL”

syntax “perl” “\.cgi$”
color brightblue “\<(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 brightblue “\<(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 brightmagenta start=”[$@%]” end=”( |\\W|-)”
color brightred “”.*”|qq\|.*\|”
color white “[sm]/.*/”
color brightblue start=”(^use| = new)” end=”;”
color brightgreen “#.*”
color brightred start=”<<EOSQL” end=”EOSQL”

syntax “perl” “\.txy$”
color brightblue “\<(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 brightblue “\<(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 brightmagenta start=”[$@%]” end=”( |\\W|-)”
color brightred “”.*”|qq\|.*\|”
color white “[sm]/.*/”
color brightblue start=”(^use| = new)” end=”;”
color brightgreen “#.*”
color brightred start=”<<EOSQL” end=”EOSQL”

syntax “perl test” “\.tpm$”
color brightblue “\<(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 brightblue “\<(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 brightmagenta start=”[$@%]” end=”( |\\W|-)”
color brightred “”.*”|qq\|.*\|”
color white “[sm]/.*/”
color brightblue start=”(^use| = new)” end=”;”
color brightgreen “#.*”
color brightred start=”<<EOSQL” end=”EOSQL”

## 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=”\*/”



## 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 “^#.*$”



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 “#.*$”

 

# C syntax highlighting
#######################
syntax “c-file” “\.(c|h)$”
color red “\<[A-Z_]{2,}\>”
color green “\<(char|const|float|int|static|struct|void)\>”
color brightyellow “\<(case|do|if|else|switch|while)\>”
color brightcyan “^#( )*(define|include|ifn?def|endif|elif|else|if)”
color brightyellow “<[^= ]*>” “”(
\\.|[^\“])*””
color brightyellow start=””(
\\.|[^\”])*\\( |)*$” end=”^(\\.|[^\“])*””
color brightblue “//.*”
color brightblue start=”/\*” end=”\*/”



# HTML syntax highlighting
##########################
syntax “HTML” “\.html$”
color blue start=”<” end=”>”
color red “&[^; ]*;”



# Perl syntax highlighting
##########################
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=”<< ‘EOF'” end=”EOF”



# Generic conf/rc/sh file syntax highlighting
#############################################
syntax “conf/rc/sh” “conf$|rc$|sh$”
color white “.+”
color green “^#.*”



# .nanorc syntax highlighting
#############################
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)?(black|blue|cyan|green|magenta|red|white|yellow)\>”
color magenta “^ *color\>”
color green “^#.*$”



# Fluxbox apps syntax highlighting
##################################
syntax “flux-apps” “apps”
color green “^\[.+\]”
color yellow “\(.+\)”
color white “\{.+\}”



# Fluxbox init syntax highlighting
##################################
syntax “flux-init” “init”
color magenta “^session.+:”
color cyan “\s.+$”



# Fluxbox keys syntax highlighting
##################################
syntax “flux-keys” “keys”
color magenta “^Mod1”
color cyan “(F.|F..|Shift|Tab)”



# Fluxbox menu syntax highlighting
##################################
syntax “flux-menu” “menu”
color green “^\[.+\]”
color magenta “\[(commanddialog|config|exec|exit|reconfig|restart|separator|stylesdir|workspaces)\]”
color yellow “\(.+\)”
color white “\{.+\}”
color blue “<.+>”



# sources.list syntax highlighting
##################################
syntax “sources.list” “\.list$”
color red “^rpm”
color blue “http.+”
color magenta “(el3-i386.+|redhat.+|rh9.+|sl3-i386.+)”
color white “(at-stable|dag|legacy-utils|os|release|stable|updates|updates-legacy)”
color green “^#.*”



# grub.conf syntax highlighting
###############################
syntax “grub.conf” “grub\.conf”
color cyan “(^default.+|^timeout.+)”
color red “^title.+”
color yellow “(initrd.+|kernel.+|root.+)”
color green “^#.*”


#php syntax
###############################
syntax “php” “.*/*.php$”
color brightwhite “\{|\}|\.”
color red “(‘[^’]*’)”
color red “\”[^\”]*\””
color brightblue “(\$([[:alpha:]_]|->)*)”
color brightgreen “((\$(([[:alpha:]_0-9])+\->)+)[[:alpha:]_0-9]+\()”
color yellow ” (if|else if|else|return|case|break)”
color yellow “\|\||\?|!|\||&&|=|;|\(|\)”
color red “false|true”
color brightwhite “[[:space:]]+debug|[[:space:]]+echo|\$this\->debug”
color cyan “//.*”
color cyan start=”/\*” end=”\*/”

# Ini file
##########
syntax “ini” “.ini$”
color white “.+”
color green “^;.*”

# rc.local syntax
#################
syntax “local” “.local$”
color white “.+”
color green “^#.*”

# rc.local syntax
#################
syntax “cfg” “.cfg$”
color white “.+”
color green “^#.*”

############### END COPY ################

Tinggalkan Balasan

Please log in using one of these methods to post your comment:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

ABout Me!


WordPress ini sengaja saya buat untuk menulis apa yang telah saya lakukan agar saya selalu ingat, tulisan yang saya buat kebanyakan dalam bentuk tutorials configurasi linux dari hasil uji coba saya dan sebahagian di kutip dari beberapa website lain yang saya anggap perlu untuk saya tulis disini. Mudah-mudahan tutorial yang saya buat ini berguna buat pencinta linux yang lain. Salam Sejahtera.

Blog Stats

  • 120,467 hits

Linux Inspiration

%d blogger menyukai ini: