You are not logged in.
Pages: 1
Topic closed
Hey guys, for simple tasks, I tend to use nano, as it's real lightweight. Most people don't know you can do syntax highlighting in nano, so here's one for PKGBUILD syntax to get your feet wet.
Put this in /etc/nanorc or ~/.nanorc
syntax "pkgbuild" "^PKGBUILD$"
color green "<(pkgname|pkgver|pkgrel|pkgdesc|force|url|license|backup|makedepends|depends|source|md5sums|groups|confilcts|provides|replaces)>"
color brightgreen "build()" "{" "}"
color red "<(cp|mv|cd|mkdir|return)>"
color cyan "<(configure|make|install)>"
color blue "#.*"
color brightwhite "<(DESTDIR|PREFIX|prefix)>"
Now, it's not perfect, for instance, the term "install" appears all over the place... install=package.install, make install, install -m755.... so there's just one color for it.... the colors are pseudo random (I just picked them off the top of my head)...
Offline
BTW. I filed a bug report about nano.
http://bugs.archlinux.org/index.php?do=details&id=1804
It looks for nanorc in /usr/etc not in /etc. Adding --sysconfdir=/etc to configure and recompiling fixes this of course.
I tried to extend your coloring settings. It's not as easy as it looks :-) Not quite how I wanted it to but here it is my /etc/nanorc
set autoindent
set const
set historylog
set nowrap
set smooth
set speller "aspell -c"
set tabsize 4
set backup
set regexp
syntax "pkgbuild" "^.*PKGBUILD$"
color green start="^" end="$"
color cyan "^.*(pkgname|pkgver|pkgrel|pkgdesc|force|url|license|install|source|md5sums|groups|backup|depends|makedepends|conflicts|provides|replaces).*=.*$"
color brightcyan "<(pkgname|pkgver|pkgrel|pkgdesc|force|url|license|install|source|md5sums|groups|backup|depends|makedepends|conflicts|provides|replaces)>"
color cyan ".install"
color brightwhite "=" "'" "(" ")" """ "#.*$" "," "{" "}"
color brightcyan "($|${|$()(pkgname|pkgver|pkgrel|pkgdesc|force|url|license|install|source|md5sums|groups|backup|depends|makedepends|conflicts|provides|replaces|startdir)(|}|))"
color brightred "build()"
color brightred "<(configure|make)>"
color red "<(DESTDIR|PREFIX|prefix|sysconfdir|datadir|libdir|includedir|mandir)>"
I'll try to improve it if I find some time this weekend.
Maybe someone else also has any ideas how cat this be improved and simplified?
Offline
i just want to add my nanorc
set autoindent
set const
set historylog
set nowrap
set smooth
set speller "aspell -c"
set regexp
set fill 72
set multibuffer
set nohelp
set suspend
syntax "pkgbuild" "^.*PKGBUILD$"
color green start="^" end="$"
color cyan "^.*(pkgname|pkgver|pkgrel|pkgdesc|force|url|license|install|source|md5sums|groups|backup|depends|makedepends|conflicts|provides|replaces).*=.*$"
color brightcyan "<(pkgname|pkgver|pkgrel|pkgdesc|force|url|license|install|source|md5sums|groups|backup|depends|makedepends|conflicts|provides|replaces)>"
color cyan ".install"
color brightwhite "=" "'" "(" ")" """ "#.*$" "," "{" "}"
color brightcyan "($|${|$()(pkgname|pkgver|pkgrel|pkgdesc|force|url|license|install|source|md5sums|groups|backup|depends|makedepends|conflicts|provides|replaces|startdir)(|}|))"
color brightred "build()"
color brightred "<(configure|make)>"
color red "<(DESTDIR|PREFIX|prefix|sysconfdir|datadir|libdir|includedir|mandir)>"
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)"
syntax "php" ".php[2345s~]?$"
color brightblue "(.*)("
color blue "$[a-zA-Z_0-9$]*|[=!<>]"
color green "(var|class|function|echo|case|break|default|exit|switch|if|else|elseif|@|while)s"
color green "[.,{}();]"
color red "('.*')|(".*")"
color brightyellow "(#.*|//.*)$"
color brightyellow start="/*" end="*/"
color brightblue "(<?(php)?|?>)"
color white start="?>" end="<?(php)?"
syntax "HTML" ".html$"
color blue start="<" end=">"
color red "&[^; ]*;"
syntax "patch" ".(patch|diff)$"
color brightgreen "^+.*"
color green "^+++.*"
color brightblue "^ .*"
color brightred "^-.*"
color red "^---.*"
color brightyellow "^@@.*"
color magenta "^diff.*"
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 " +$"
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 in xorg.conf
##
syntax "xorg" "xorg.conf$"
color brightwhite "(Section|EndSection|Sub[sS]ection|EndSub[sS]ection)"
# keywords
color yellow "[^A-Za-z0-9](Identifier|Screen|InputDevice|Option|RightOf|LeftOf|Driver|RgbPath|FontPath|ModulePath|Load|VendorName|ModelName|BoardName|BusID|Device|Monitor|DefaultDepth|View[pP]ort|Depth|Virtual|Modes|Mode|DefaultColorDepth|Modeline|+vsync|+hsync|HorizSync|VertRefresh)[^A-Za-z0-9]"
# numbers
color magenta "[0-9]"
# strings
color green ""(\.|[^"])*""
# comments
color white "#.*"
# 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 "^#.*$"
this works for nano 1.2.5!!
THX!!
cu matsche
Offline
Thanks all! This a wonderful thread to find (I <3 nano!).
·¬»· i am shadowhand, powered by webfaction
Offline
kick arse! i never knew nano could do all this!
Offline
set multibuffer
this doesn't work anylonger in nano2!
I'm still looking for syntax highlighting in nano!
THX!!
cu matsche
Offline
Hey guys, for simple tasks, I tend to use nano, as it's real lightweight. Most people don't know you can do syntax highlighting in nano, so here's one for PKGBUILD syntax to get your feet wet.
Thanks for nanorc, phrakture!
BTW, have you tried mc-colorer from AUR?
to live is to die
Offline
Thanks a lot for bringing this thread back to life! I really didn't know about the highlighting features of nano....
Haven't been here in a while. Still rocking Arch.
Offline
Does anyone know how the Installer does its nano colours?
Offline
Hey guys, for simple tasks, I tend to use nano, as it's real lightweight.
No way man, why? It only takes a sec to load up vim and power away... *stares menacingly at arrow keys*
Offline
phrakture wrote:Hey guys, for simple tasks, I tend to use nano, as it's real lightweight.
No way man, why? It only takes a sec to load up vim and power away... *stares menacingly at arrow keys*
Old thread is oooollld.
Offline
KomodoDave wrote:phrakture wrote:Hey guys, for simple tasks, I tend to use nano, as it's real lightweight.
No way man, why? It only takes a sec to load up vim and power away... *stares menacingly at arrow keys*
Old thread is oooollld.
Haha, don't dodge the question! =P
Edit: Wait, does that mean you no longer resort to such foolish tactics?
- Dave
Last edited by KomodoDave (2007-06-04 18:58:58)
Offline
Edit: Wait, does that mean you no longer resort to such foolish tactics?
- Dave
He's a bigger nano user than ever before.
I am a gated community.
Offline
KomodoDave wrote:Edit: Wait, does that mean you no longer resort to such foolish tactics?
- Dave
He's a bigger nano user than ever before.
No way! *scoff, chortle*
- Dave
Offline
KomodoDave wrote:Edit: Wait, does that mean you no longer resort to such foolish tactics?
- Dave
He's a bigger nano user than ever before.
I actually run notepad in wine for quick tasks.
Offline
Geeting an error with the PKGBUILD syntax (as listed above):
$nano /etc/nanorc
Error in /etc/nanorc on line 54: Bad regex "(": Unmatched ( or \(
Error in /etc/nanorc on line 54: Bad regex "{": Invalid preceding regular expression
Error in /etc/nanorc on line 55: Bad regex "($|${|$()(pkgname|pkgver|pkgrel|pkgdesc|force|url|license|install|source|md5sums|groups|backup|depends|makedepends|conflicts|provides|replaces|startdir)(|}|))": Invalid preceding regular expression
Press Enter to continue starting nano.
Any ideas? Thanks.
Offline
Escape parenthesis and brackets :
## Here is an example for PKGBUILD
##
syntax "pkgbuild" "^.*PKGBUILD$"
color green start="^" end="$"
color cyan "^.*(pkgname|pkgver|pkgrel|pkgdesc|force|url|license|install|source|md5sums|groups|backup|depends|makedepends|conflicts|provides|replaces).*=.*$"
color brightcyan "<(pkgname|pkgver|pkgrel|pkgdesc|force|url|license|install|source|md5sums|groups|backup|depends|makedepends|conflicts|provides|replaces)>"
color cyan ".install"
color brightwhite "=" "'" "\(" "\)" """ "#.*$" "," "\{" "\}"
#color brightcyan "($|${|$()(pkgname|pkgver|pkgrel|pkgdesc|force|url|license|install|source|md5sums|groups|backup|depends|makedepends|conflicts|provides|replaces|startdir)(|}|))"
color brightcyan "($|$\{|$\(\)(pkgname|pkgver|pkgrel|pkgdesc|force|url|license|install|source|md5sums|groups|backup|depends|makedepends|conflicts|provides|replaces|startdir)\(|\}|\))"
color brightred "build()"
color brightred "<(configure|make)>"
color red "<(DESTDIR|PREFIX|prefix|sysconfdir|datadir|libdir|includedir|mandir)>"
Answering a bit late but it could help others
Offline
Just one year and 3 months
but thank you making me rediscovering the nano experience
Ah, good taste! What a dreadful thing! Taste is the enemy of creativeness.
Picasso
Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away.
Saint Exupéry
Offline
Just one year and 3 months
I faced the issue yesterday and found the thread while looking for *.nanorc files
Offline
hi,
this syntax file PKGBUILD is not working in my nano 2.0.9. The sreen remains black! Any changes needed?
Last edited by matsche (2009-06-03 17:37:00)
THX!!
cu matsche
Offline
1) old
2) no idea. sorry
3) nano? and you found it weird i use joe!
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline
hi,
this syntax file PKGBUILD is not working in my nano 2.0.9. The sreen remains black! Any changes needed?
If it used to work and now it doesn't, check what other packages have been updated in the meantime. Either way, check your /usr/share/nano/pkgbuild.nanorc and /etc/nanorc files. Maybe those got changed unintentionally.
Offline
KomodoDave wrote:phrakture wrote:Hey guys, for simple tasks, I tend to use nano, as it's real lightweight.
No way man, why? It only takes a sec to load up vim and power away... *stares menacingly at arrow keys*
Old thread is oooollld.
and
1) old
2) no idea. sorry
3) nano? and you found it weird i use joe!
Here comes the lock! Leave those zombies alone!
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
you forgot to push the button
Offline
I did... Fixed
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
Pages: 1
Topic closed