Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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?$"


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:


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


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

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.