Skip to content
This repository was archived by the owner on Dec 1, 2020. It is now read-only.

Commit b880101

Browse files
committed
Add two new matches, phpUseFunction and phpUseClass.
These can be used to customise how class or function names are highlighted in statements: use Class\Name; use function function\name; This follows up on #42 and #45 "Support "use function" properly".
1 parent 85a6cac commit b880101

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

syntax/php.vim

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ syn keyword phpStatement __construct __destruct __call __callStatic __get __set
519519
syn keyword phpKeyword die exit eval empty isset unset list instanceof insteadof contained
520520

521521
" Include & friends
522-
syn keyword phpInclude include include_once require require_once namespace use contained
522+
syn keyword phpInclude include include_once require require_once namespace contained
523523

524524
" Types
525525
syn keyword phpType bool[ean] int[eger] real double float string array object null self parent global this stdClass callable contained
@@ -679,10 +679,17 @@ syntax match phpClassImplements contained
679679
syntax match phpClassDelimiter contained
680680
\ nextgroup=phpClassImplements skipwhite skipempty /,/
681681

682+
" use statement
683+
syn keyword phpInclude use contained
684+
\ nextgroup=phpUseFunction,phpUseClass skipwhite skipempty
685+
syn match phpUseFunction /function\s\+\(\\\|\h\w*\)*\h\w*/ contained contains=phpUseKeyword
686+
syn match phpUseClass /\(function\s\+\)\@!\(\\\|\h\w*\)*\h\w*/ contained
687+
syn match phpUseKeyword /function\s\+/ contained contains=phpKeyword
688+
682689
" Function name
683690
syn keyword phpKeyword function contained
684691
\ nextgroup=phpFunction skipwhite skipempty
685-
syn match phpFunction /\(use\sfunction\s*\)\@<!\h\w*/
692+
syn match phpFunction /\h\w*/
686693

687694
" Clusters
688695
syn cluster phpClConst contains=phpFunctions,phpClasses,phpStaticClasses,phpIdentifier,phpStatement,phpKeyword,phpOperator,phpSplatOperator,phpStringSingle,phpStringDouble,phpBacktick,phpNumber,phpType,phpBoolean,phpStructure,phpMethodsVar,phpConstants,phpException,phpSuperglobals,phpMagicConstants,phpServerVars

0 commit comments

Comments
 (0)