Notepad++ Edit syntax highlighting for PHP?
20,367
Solution 1
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
Solution 2
To edit the syntax highlighting in Notepad++
, follow these steps:
- Go to
Settings
, thenStyle
. The configurator dialog opens. - Select language
php
- Select the style based on your criteria
- Save
Author by
user422039
Updated on August 23, 2020Comments
-
user422039 over 3 years
I'd like to edit the syntax highlighting for PHP in Notepad++:
- To have variables starting with
$_
in a different color than variables starting with only$
- To have operators like
{} () []
in different colors than operators like& =
Is it possible to change the highlighting to be this in-depth? How?
- To have variables starting with
-
BoltClock over 13 yearsThe last step kind of makes this less useful than it potentially could be. But wow, I didn't know this feature existed.
-
Geoffrey over 13 years@BoltClock, I also just learned about this now. I have edited my answer. It seems one can give the userdefined language the same file extension. Then it will also work.
-
Wolfpack'08 about 8 yearsI disagree. Creating a custom language takes much longer than editing an existing language; therefore, this isn't the answer users coming to this page are seeking out. It's a waste of time for users seeking this question. This answer should not have been posted and is flagged for removal. Either the question title should be changed such that people not seeking this issue aren't drawn here, or we should try to find a real answer.
-
andreszs about 7 yearsAny ideas how to define a new group in order to separate constants from functions? It's annoying to use the same color for them when they are totally different things...