View previous topic :: View next topic |
Author |
Message |
wdreinhart Guru
Joined: 11 Jun 2003 Posts: 569 Location: 4QFJ12345678
|
Posted: Thu Sep 18, 2003 11:00 pm Post subject: Enable nano syntax highlighting |
|
|
Not everyone knows it, but Gentoo's favorite edito, nano, supports syntax hilighting. To enable it, you will need to gunzip /usr/doc/nano-1.2.2/nanorc.sample.gz and name it "~/.nanorc". Then all you have to do is open it (in nano, of course!) and uncomment the syntax blocks for files you want to enable syntax hilighting in.
I have a very basic .ebuild syntax block here if anyone is interested in that. Please post udated versions if you improve on it.
Code: |
syntax "ebuild" "\.ebuild$"
color brightcyan "^ *eclass\>" "^ *inherit\>"
color brightwhite "^ *src [^ ]*"
color brightblue "src_compile\>" "src_unpack\>" "src_install\>" "^ *einfo\>" "$ color yellow "^ *export\>"
color magenta "\<(if|then|fi)\>"
color green "#.*$"
|
|
|
Back to top |
|
|
marshall_j Tux's lil' helper
Joined: 22 Jan 2003 Posts: 98 Location: NZ
|
Posted: Fri Sep 19, 2003 1:24 am Post subject: |
|
|
This came up in a earlier thread but it started off about vim or something so I think lots of people could have missed it. Nano should come out of the box like this!
This is one that will just highlight all comments in blue. I find it handy for all the misc files just so you can see what should be edited and what should be read:
Code: |
syntax "default" ".*"
color blue "^#.*"
|
Make sure you put it first if you add it to your nanorc file tho as the entries at the bottom overwrite the ones at the top. |
|
Back to top |
|
|
meowsqueak Veteran
Joined: 26 Aug 2003 Posts: 1549 Location: New Zealand
|
Posted: Fri Sep 19, 2003 2:08 am Post subject: |
|
|
And for editing your .emacs file (but why you'd do this in nano and not emacs is another question entirely):
Code: | syntax "dotemacs" "^.emacs$"
color green "^;.*" |
It's simple but hopefully as more people read this thread and get the 'idea' we'll see more complex ones |
|
Back to top |
|
|
fca Guru
Joined: 22 Feb 2003 Posts: 346 Location: Netherlands
|
Posted: Sat Sep 20, 2003 11:15 pm Post subject: |
|
|
Some more ebuild high-lighting:
Code: |
syntax "ebuild" "\.ebuild$"
color brightcyan "^ *eclass\>" "^ *inherit\>"
color brightwhite "^ *src [^ ]*"
color brightblue "src_compile\>" "src_unpack\>" "src_install\>" "e(info|begin|end|warn|error|patch)\>" "^ *die\>"
color brightmagenta "use\>" "^ *IUSE\>" "^ *(filter|strip|allowed)-flags\>"
color cyan "^ *keepdir\>" "^ *dodir\>" "^ *doman\>"
color yellow "^ *export\>"
color magenta "\<(if|then|else|fi)\>"
color brightgreen "\$\{(.|([A-Z_]*))\}"
color green "#.*$"
|
|
|
Back to top |
|
|
duende n00b
Joined: 05 Oct 2003 Posts: 21
|
Posted: Wed Oct 15, 2003 5:46 pm Post subject: |
|
|
Does anyone have an entry to enable PHP syntax highlighting? |
|
Back to top |
|
|
neenee Veteran
Joined: 20 Jul 2003 Posts: 1786
|
Posted: Wed Oct 15, 2003 6:38 pm Post subject: |
|
|
i'd just like to say that i love this thread. |
|
Back to top |
|
|
morb n00b
Joined: 29 Oct 2003 Posts: 1
|
Posted: Wed Oct 29, 2003 6:35 am Post subject: php syntax highlighting |
|
|
heres the php syntax you asked for duende, please post any updates if needed!
Code: | 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|\?>)" |
|
|
Back to top |
|
|
Mafteah Apprentice
Joined: 30 May 2003 Posts: 265 Location: IL
|
Posted: Wed Oct 29, 2003 7:33 pm Post subject: |
|
|
Someone have entry for c/cpp/h etc. files? _________________ http://www.mafteah.co.il |
|
Back to top |
|
|
Loke Apprentice
Joined: 25 May 2002 Posts: 274 Location: Norway
|
Posted: Fri Oct 31, 2003 4:04 am Post subject: |
|
|
Mafteah wrote: | Someone have entry for c/cpp/h etc. files? |
Already present in the sample .nanorc file _________________ I'm not saying there should be capital punishment for stupidity, I'm saying why don't we take the warning labels off of everything, and let the problem take care of itself? |
|
Back to top |
|
|
roofy Tux's lil' helper
Joined: 01 Sep 2003 Posts: 86 Location: miami
|
Posted: Fri Nov 07, 2003 5:12 pm Post subject: bash? |
|
|
can anyone whip up some bash highlighting? _________________ /* event horizon */
Athlon XP 2100+ (o/c'ed to 2.1ghz)
LanParty NForce2 Ultra
80GB Maxtor HD
48x CD-RW
ATI 9700 Pro |
|
Back to top |
|
|
neenee Veteran
Joined: 20 Jul 2003 Posts: 1786
|
Posted: Fri Nov 07, 2003 5:44 pm Post subject: |
|
|
please search for bash colors/modifications using google.com/linux
or on these forums. to start you off a bit, my personal favourite is
vico's. |
|
Back to top |
|
|
Snake007uk Apprentice
Joined: 12 Jan 2003 Posts: 198 Location: London, UK
|
Posted: Thu Mar 18, 2004 10:46 pm Post subject: |
|
|
why not just make an ebuild called gentoo colour which does this ??? _________________ Snake
Dual AMD MP 2800+, Asus A7M266-D, 1GB Ram, 18.1GB u160 HD, ATI Radeon 9600 Pro, Creative Audigy ZS, Intel SRCU31A, Linksys NIC, iiyama 18.1 4637bk lcd |
|
Back to top |
|
|
stahlsau Guru
Joined: 09 Jan 2004 Posts: 584 Location: WildWestwoods
|
Posted: Fri Mar 19, 2004 7:28 am Post subject: |
|
|
Quote: | This is one that will just highlight all comments in blue. I find it handy for all the misc files just so you can see what should be edited and what should be read:
Code:
syntax "default" ".*"
color blue "^#.*" |
I love you guys....thx! |
|
Back to top |
|
|
meowsqueak Veteran
Joined: 26 Aug 2003 Posts: 1549 Location: New Zealand
|
Posted: Fri Mar 19, 2004 8:38 am Post subject: |
|
|
You can extend this slightly to catch indented comments, which are present in some sorts of files:
Code: | syntax "default" ".*"
color blue "^[ \t]*#.* |
|
|
Back to top |
|
|
neenee Veteran
Joined: 20 Jul 2003 Posts: 1786
|
Posted: Fri Mar 19, 2004 12:40 pm Post subject: |
|
|
thanks
(this post also serves as a bump since i'd like
to see more ideas people have had) |
|
Back to top |
|
|
jhgz1 Retired Dev
Joined: 16 Dec 2003 Posts: 115 Location: Gainesville
|
Posted: Mon Mar 22, 2004 6:29 pm Post subject: |
|
|
the blue coloring of the comments looks really great!
great job man! |
|
Back to top |
|
|
Chrisje n00b
Joined: 07 Jun 2003 Posts: 33 Location: The Netherlands
|
Posted: Tue Mar 23, 2004 8:13 pm Post subject: |
|
|
ow yeah.. sweet!
thx! |
|
Back to top |
|
|
Cid Apprentice
Joined: 19 Dec 2003 Posts: 155 Location: New York
|
Posted: Fri Apr 23, 2004 2:53 pm Post subject: python coloring |
|
|
hi, can anyone help with python syntax coloring? i found this:
Code: |
syntax "python" "\.py$"
color red "[\[\](){}:]"
color brightblue "\<__dict__\>"
color green "#.*"
color cyan "([\"']).*?[^\\]\1"
# this is kludge to avoid the line for the example C syntax marked "this is wastefu$color cyan "\"\"" "''"
color cyan start="\"\"\"" end="\"\"\""
|
but i'm getting an error on the color red "[\[\](){}:]" line saying:
Code: |
Error in /home/chris/.nanorc on line 275: Bad regex "[\[\](){}:]": Invalid content of \{\}
|
also, is there a way to make it so any characters after a # is the comment color? it's only working for comments that start at the beginning. thanks a lot _________________ Spiral out. Keep going... |
|
Back to top |
|
|
meowsqueak Veteran
Joined: 26 Aug 2003 Posts: 1549 Location: New Zealand
|
Posted: Fri Apr 23, 2004 11:48 pm Post subject: |
|
|
I imagine you'll need to escape () too. I.e. \(\).
Anything after a hash:
I realise you've already got this - but it works for me... |
|
Back to top |
|
|
Cid Apprentice
Joined: 19 Dec 2003 Posts: 155 Location: New York
|
Posted: Sat Apr 24, 2004 1:06 am Post subject: |
|
|
i tried putting those escapes, but it still didn't work. and the comment one i have is the same as yours but mine only colors the comments that start on the beginning of the line. _________________ Spiral out. Keep going... |
|
Back to top |
|
|
singular n00b
Joined: 07 Jun 2003 Posts: 54
|
Posted: Sat Apr 24, 2004 7:46 pm Post subject: |
|
|
For python highlighting, here is the one I came up with.
I used the same sequence for strings that you have since it works better than the one I first used.
Code: | 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 "#.*$"
|
Note that there isn't supposed to be a line break after brightcyan. But I can't seem to prevent it from getting posted that way. |
|
Back to top |
|
|
LeTene Guru
Joined: 02 Mar 2004 Posts: 348 Location: Ah'll glass ye!
|
Posted: Sat Jul 10, 2004 7:16 pm Post subject: |
|
|
Bumpity for this cool thread - now I can do my PHP coding over SSH without bitching & griping . _________________ Docs, Tips & Tricks at the Gentoo Wiki page. |
|
Back to top |
|
|
allucid Veteran
Joined: 02 Nov 2002 Posts: 1314 Location: atlanta
|
Posted: Sat Jul 10, 2004 7:50 pm Post subject: Re: Enable nano syntax highlighting |
|
|
wdreinhart wrote: | Not everyone knows it, but Gentoo's favorite edito, nano, supports syntax hilighting. To enable it, you will need to gunzip /usr/doc/nano-1.2.2/nanorc.sample.gz and name it "~/.nanorc". Then all you have to do is open it (in nano, of course!) and uncomment the syntax blocks for files you want to enable syntax hilighting in.
I have a very basic .ebuild syntax block here if anyone is interested in that. Please post udated versions if you improve on it.
Code: |
syntax "ebuild" "\.ebuild$"
color brightcyan "^ *eclass\>" "^ *inherit\>"
color brightwhite "^ *src [^ ]*"
color brightblue "src_compile\>" "src_unpack\>" "src_install\>" "^ *einfo\>" "$ color yellow "^ *export\>"
color magenta "\<(if|then|fi)\>"
color green "#.*$"
|
|
also check out /etc/nanorc (which is kept up-to-date by portage) |
|
Back to top |
|
|
Xk2c Apprentice
Joined: 17 Jul 2004 Posts: 240
|
Posted: Tue Jul 20, 2004 5:50 pm Post subject: hightlighting with Nano in "normal Config" files |
|
|
Hello
I´ve done my own nanorc with hightlight for perhaps 90% of the Configurationfiles .
Please have a look here :
http://article.gmane.org/gmane.linux.gentoo.user.german/9565
This post is in German, but there are two nanorc in the end.
One for white and one for black background.
Do you have Ideas to get it even better ?
I think it would be great to have something like this to come per default with nano.
I´ve thought about to create a bug to enhance nano with that.
Ist that the right way ?
Is someone responsible for nano here ?
bye Thilo
PS. mail if you are interested in this nanorc _________________ useful Xterm, Aterm and RXVT-Unicode features
Last edited by Xk2c on Mon Aug 30, 2004 10:58 am; edited 1 time in total |
|
Back to top |
|
|
Xk2c Apprentice
Joined: 17 Jul 2004 Posts: 240
|
|
Back to top |
|
|
|