11

I know I'm not the first to need this. I am working on an in house created codebase and I would like to apply highlighting to it within Eclipse. In Notepad++ I can set language for the file I'm looking at. Is there any way to do this for Eclipse?

The code I'm working on would use the same syntax styling as C++.

Donovan
  • 906
  • 2
  • 11
  • 17

2 Answers2

17

Your best bet is to go to Preferences -> General -> Editors -> File associations. Add the file extension of the thing you are trying to open and add the C++ editor as the associated default editor.

If there is no file extension, then things are a little harder. Instead of double-clicking to open the file, right-click -> Open with... -> other -> C++ editor. This will remember your choice for that file only.

Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148
  • 1
    Thanks. I had tried this before but no highlighting was applied. I noticed that in order for it to work you have to have the color editor first in the list of editors for the extension. I do notice some of the syntax coloring is still different however. Is there a way to set custom colors? or change the colors used? – Donovan Jun 01 '12 at 20:52
  • I don't know much about CDT, but I would imagine that there's something like the functionality that you get for JDT. Ie, Preferences -> Java -> Editor -> syntax coloring. – Andrew Eisenberg Jun 01 '12 at 21:36
1

As Andrew Eisenberg said, go to Window --> Preferences --> General --> Editors --> File Associations and ensure your choices for editor for each file type are correct according to your desires.

However, for Eclipse CDT most of your file types are set in Preferences --> C/C++ --> File Types instead.

Also, like he said, you can use the right-click menu to choose your own editor, including an external system editor, such as Sublime Text 3, Atom, Visual Studio Code, Notepad++, etc.
Right click on the file --> Open With --> Other... --> choose an "Internal editor" or "External program" to your liking, optionally checking the box at the bottom to make this the default choice next time.

Gabriel Staples
  • 36,492
  • 15
  • 194
  • 265