2

I like portability between systems and I was trying to make my nano editor look as much as possible like Sublime Text (on Linux Mint). I want to color function names too. So far I managed to make it as shown in the picture:

Sublime Text and nano side-to-side

The code I used is a bit of a cheat. I color void itself and the space after until the next space:

color brightyellow  start="void " end="[ ]"
color cyan "void"

The reason I color it twice is that it makes void bright yellow too, plus it works only if I write my code like:

void fu (void);

with a space between fu and (.

However, if I write the code as:

void fu(void);

it breaks.

My question is how do I write start="void " end="(" in c.nanorc, in such a way to start from void to ( but ignore the words themselves?

Zanna
  • 3,491
  • 18
  • 28
Spiritus
  • 21
  • 1
  • Why don't you just install Sublime on the second box, if that's what you normally use? – Marc Wilson May 13 '21 at 19:09
  • nano is for Raspberry PI Zero with LITE OS. On lite os you dont even have desktop, its all done via ssh – Spiritus May 13 '21 at 21:33
  • As many programming languages only allow alphanumeric characters and only a few special chars, (`_`), you can use a simple regex on the function identifier like `color brightyellow "void [a-zA-Z0-9_]+"`. For more flexibility, you want want to replace the space with `[[:space:]]+`. And for the `end="("` you need to escape the `\(`. Although "a little bit" late, maybe someone might find this helpful... – flederwiesel Nov 16 '22 at 13:46

0 Answers0