Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

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

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.