Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ Edit syntax highlighting for PHP?

Tags:

php

notepad++

I'd like to edit the syntax highlighting for PHP in Notepad++:

  1. To have variables starting with $_ in a different color than variables starting with only $
  2. To have operators like {} () [] in different colors than operators like & =

Is it possible to change the highlighting to be this in-depth? How?

like image 315
user422039 Avatar asked Dec 17 '10 19:12

user422039


People also ask

How do I add syntax highlights to Notepad?

To configure syntax highlighting, click on “Language” in the top bar, then click the letter the language starts with, and then the language. If you want to define your own language, click on “Language” again, then click on “User Defined Language”, third from the bottom, and then click “Define your language”.

How do I highlight in PHP?

The highlight_string() function outputs a string with the PHP syntax highlighted. The string is highlighted by using HTML tags. The colors used for syntax highlighting can be set in the php. ini file or with the ini_set() function.

Does Notepad have syntax highlighting?

Like other text editors, Notepad++ (which is recommended by the basic tutorial) uses a system called Syntax Highlighting which helps in coding by visually identifying different parts of code with color.

How do I change the highlight color in Notepad++?

Style Configurator -> Global Styles -> Selected text colour. This is basically going to change the color of the selected text.


1 Answers

This is Possible

In Notepad++, define a new language by clicking View > User-Defined Dialogue...

Give the language a name (e.g. myPHP). Set the ext (file extension abbreviation) to php. Define the color coding for the global variables and for the brackets, braces and parentheses, etc. Close the Dialoague.

That is all. The formatting for myPHP which conflicts with the formatting for PHP will override the formatting for PHP, i.e. if the file has a .php extension.

More information: Notepad++ Wiki

like image 67
Geoffrey Avatar answered Sep 20 '22 14:09

Geoffrey