StanAngeloff / php.vim

An up-to-date Vim syntax for PHP (7.x supported)
477 stars 69 forks source link

Detect functions and constants heuristically #55

Closed msjyoo closed 5 years ago

msjyoo commented 8 years ago

For example, if a constant is in all upper case letters, then there should be an option to consider it as a constant and apply syntax to it accordingly.

Similarly to functions e.g. func( with bracket could be considered a function (phpUserFunc and phpUserConst)?

VonHeikemen commented 5 years ago

Using the syntax override method suggested on the readme, one could do this to highlight function calls.

function! PhpSyntaxOverride()
  syn match phpFunctionCall /\v\h\w*\ze(\s?\()/ 
    \ containedin=phpRegion,phpIdentifier

endfunction

augroup phpSyntaxOverride
  autocmd!
  autocmd FileType php call PhpSyntaxOverride()
augroup END

I'm sure there is a better way to do it inside the plugin itself.