Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Has anyone got (or can point in the direction of) a nanorc file that contains syntax highlighting for C# and/or ASP.Net?

share|improve this question
There is an emacs one, but that wasn't your question ;-) – Chris Huang-Leaver Aug 15 '10 at 7:24
Are you kidding right? Why would you use that editor for C# programming. Try [MonoDevelop][1], if you're serious about learning C# in Linux, it's WAY BETTER, in my humble opinion. [1]: monodevelop.com – Mnemonic Flow Aug 18 '10 at 21:45
Oh I have MonoDevelop set up too, but sometimes I need to work over a console-only SSH session – Rob Cowell Aug 19 '10 at 14:17
Ugh... this really makes me hope my proposal gets some traction because I kinda feel that this has no business here.... this is a site about unix not development environments. – xenoterracide Aug 25 '10 at 14:43
up vote 3 down vote accepted

Using the Java example from http://wiki.linuxhelp.net/index.php/Nano_Syntax_Highlighting, you can try to add something like the following into your ~/.nanorc:

syntax "C# source" "\.cs$"
color green "\<(bool|byte|sbyte|char|decimal|double|float|int|uint|long|ulong|new|object|short|ushort|string|base|this|void)\>"
color red "\<(as|break|case|catch|checked|continue|default|do|else|finally|fixed|for|foreach|goto|if|is|lock|return|switch|throw|try|unchecked|while)\>"
color cyan "\<(abstract|class|const|delegate|enum|event|explicit|extern|implicit|in|internal|interface|namespace|operator|out|override|params|private|protected|public|readonly|ref|sealed|sizeof|static|struct|typeof|using|virtual|volatile)\>"
color red ""[^\"]*""
color yellow "\<(true|false|null)\>"
color blue "//.*"
color blue start="/\*" end="\*/"
color brightblue start="/\*\*" end="\*/"
color brightgreen,green " +$"
share|improve this answer

Duplicated here: http://ubuntu.stackexchange.com/questions/2163/nano-syntax-highlighting-for-c-and-or-asp-net

share|improve this answer
True, but not all Unix/Linux users are Ubuntu users. The Ubuntu SE site was in public beta first too... – Rob Cowell Aug 19 '10 at 14:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.