colorscudagedit

How to change color of words in Gedit?


I'm writing a code in CUDA C and I'm using Gedit as text editor; when I type some functions like sizeof(), the editor does not color them. In simple words this is what I would like to see:

#include <stdio.h>
#include <stdlib.h>

int main(){

int a = sizeof(int);
return 0;  
}

This is instead what i get: sizeof() not colored!! What should i do to modify the color of the function? i have already installed all the plug-in but I don't know what else to do...


Solution

  • CUDA is included by default so simply switch from plain text to CUDA (or any other language) on the right lower part of the window or using the general menu options:

    See -> Highlight mode -> CUDA

    Gedit uses GtkSourceView for syntax highlight, so you can define your own language if you want. Gedit doesn't highlight some functions like sizeof but still you can add them on the cuda.lang file:

    locate gtksourceview | grep /cuda.lang
    

    This link has more information about the definition of a language via .lang files.

    EDIT: the c language does include the definition of sizeof, so this should be useful for CUDA, search for keyword on the link!