Nano Syntax Highlighting for C in OSX Bash
Recently, I have rekindled an interest with the C programmming langauge and have decided that I would
pick up the (was K& R, I have since switched over to Programming in C by Kochan) on the subject.
Most that I know who didn’t take any formal classes on the subject recommend it.
I’m fond of editing on the go with my laptop – which for now is a Macbook pro. From experience around Linux sysadmins I knew that may edited their bashrc files for their user directory so that they could have special text highlighting and a plethora of other shortcuts. Seeing that, and spending some time in Visual Studio made me want to have some syntax highlighting for C in bash. Instead of eding the bashrc or profile though, I went with editing the nanorc.
Here’s how I did it:
- sudo mkdir /usr/local/share/nano
- sudo nano /usr/local/share/nano/c.nanorc
- I pasted in a template for C highlighting that I found on Google Code. Here
- nano ~/.nanorc
- I inculded a reference to the file I created: include “/usr/local/share/nano/c.nanorc”