12

Is there any way to change the syntax highlighting of one particular file in Eclipse?

I'm coming from the Notepad++ world where you can just select the language of the file from the drop down and it will highlight accordingly. I'm looking for that type of functionality.

Please and Thanks!

edit: JB Jansen's answer worked perfectly! Thanks!

Community
  • 1
  • 1
Jon Schwartz
  • 168
  • 1
  • 11

1 Answers1

11

You can choose what text editor to use with a given file. Right click on the file -> Open with -> Other editor, then choose the one you want.

Unfortunately, it depends on the quality of this editor.

Jean-Bernard Jansen
  • 7,544
  • 2
  • 20
  • 17
  • This didn't work for me when selecting "PHP Editor" (from pdt) on a file without an extension: "Unsupported content type in editor. To associate file extension with a supported content type, please see Content Types Preference Page". The content of the file _is_ valid PHP. – Matthijs Wessels Dec 23 '14 at 15:14
  • Yes the editors are only based on the extension, very rarely on the content. You should use an extension, even if it is not "php", and configure eclipse accordingly. Or use another editor for this particular file. Yes Eclipse should allow to force the content type on a single file, since basic editors can do that, but unfortunately, it does not. You may try this trick if you are familiar with symbolic links : http://stackoverflow.com/questions/7122886/eclipse-syntax-highlighting-on-extensionless-files/7177212#7177212 – Jean-Bernard Jansen Dec 24 '14 at 13:30
  • Can I somehow open that way a file from outside the workspace (like files from the web opened via File > Open file... > http://example.com/example.file)? – jaboja Jan 15 '15 at 11:06