# Ruby Syntax Highlighter for Nano

**URL:** <https://www.ruby-forum.com/t/ruby-syntax-highlighter-for-nano/51036>\
**Category:** Ruby\
**Created:** [December 24, 2005, 7:36am UTC](https://www.ruby-forum.com/t/ruby-syntax-highlighter-for-nano/51036 "2005-12-24T07:36:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jung](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dfb087/32.png) [@jung](https://www.ruby-forum.com/u/jung)\
**Post date:** [December 24, 2005, 7:36am UTC](https://www.ruby-forum.com/t/ruby-syntax-highlighter-for-nano/51036/1 "2005-12-24T07:36:22Z")

</div>

I spent around an hour looking for a Ruby syntax highlighter for Nano.  
I couldn’t find one so I decided to try my best at creating my own. If  
anyone has any suggestions or wants to help improve it, be my guest.

Get it here: [http://jungsource.pastebin.com/477379](http://jungsource.pastebin.com/477379)

To install:  
Copy and add all of the text from pastebin to the bottom of ~/.nanorc  
If .nanorc does not exist create it.

Nanorc doc - [Manpage of NANORC](http://www.nano-editor.org/dist/v1.2/nanorc.5.html)

Note: Tested using Nano 1.2.4 in Fedora Core 3 Linux

---

<div class="post-metadata">

**Author:** ![jung](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dfb087/32.png) [@jung](https://www.ruby-forum.com/u/jung)\
**Post date:** [December 24, 2005, 11:35am UTC](https://www.ruby-forum.com/t/ruby-syntax-highlighter-for-nano/51036/2 "2005-12-24T11:35:30Z")

</div>

Hey Jason,

Good work… i’ve searched for it too, but after looking through the  
existing  
styles i decided it’s not worth the effort and switched to vim  
instead…  
However, nano has been/and for really quick editing still is, my  
favorite  
editor.

thx a lot for your effort 🙂

```auto

Am Samstag, 24. Dezember 2005 07:36 schrieb Jason Jung:
```

---

<div class="post-metadata">

**Author:** ![jung](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dfb087/32.png) [@jung](https://www.ruby-forum.com/u/jung)\
**Post date:** [December 24, 2005, 5:51pm UTC](https://www.ruby-forum.com/t/ruby-syntax-highlighter-for-nano/51036/3 "2005-12-24T17:51:16Z")

</div>

Version 0.8.1  
Added Ryan S.'s suggestion

[http://jungsource.pastebin.com/477686](http://jungsource.pastebin.com/477686)

---

<div class="post-metadata">

**Author:** ![jung](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dfb087/32.png) [@jung](https://www.ruby-forum.com/u/jung)\
**Post date:** [December 24, 2005, 5:15pm UTC](https://www.ruby-forum.com/t/ruby-syntax-highlighter-for-nano/51036/4 "2005-12-24T17:15:09Z")

</div>

On Dec 24, 2005, at 1:36 AM, Jason Jung wrote:

> Nanorc doc - [Manpage of NANORC](http://www.nano-editor.org/dist/v1.2/nanorc.5.html)
> 
> Note: Tested using Nano 1.2.4 in Fedora Core 3 Linux
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

One quick edit to your script.

If you swap the following two segments, the highlighter won’t think “#  
{expression}” is a comment.

# Words in Quotes

#color green “”[^"]_“”  
color green “”[^"]_“|qq|._|"  
color green "‘[^’]_'”

# Comments

color brightyellow “#.\*”

TO

# Comments

color brightyellow “#.\*”

# Words in Quotes

#color green “”[^"]_“”  
color green “”[^"]_“|qq|._|"  
color green "‘[^’]_'”
