Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've already highlighted C syntax for .c files in nano by adding include "usr/share/nano/c.nanorc" to ~/.nanorc.

Unfortunately, this only works for .c files, not for .cu (CUDA) files.

How can I enable C syntax highlighting for files ending .cu?

share|improve this question

1 Answer 1

Change this line (or similar, probably first non-comment line) in /usr/share/nano/c.nanorc

syntax "c" "\.(c(c|pp|xx)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$"

to:

syntax "c" "\.(c(c|pp|u|xx)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$"

If you don't have permission to change /usr/share/nano/c.nanorc:

  1. copy it to your home, for example to ~/.c.nanorc
  2. change syntax as shown above
  3. change include in ~/.nanorc:

from:

include "usr/share/nano/c.nanorc"

to:

include "~/.c.nanorc"
share|improve this answer

Your Answer

 
discard

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.