Giter VIP home page Giter VIP logo

php-annotations-syntax's Introduction

This is a mirror of http://www.vim.org/scripts/script.php?script_id=4554

Small script to add  annotations highlighting to php syntax.

Annotations within comments are highlighted with pre-defined SpecialComment highlight group name (used for example for backslash escapes in string literals).

Annotations highlighting is useful when they are used as more then documentation blocks or comments, like for actual program flow control, as doctrine ORM is using them. Some people might consider such use of comments, as part of the program logic, to be bad practice, and the script author here tends to agree. But this is how annotation syntax works in php, so this is how they  are used anyway. Doctrine ORM tends to look for annotations anywhere within a comment line, but only annotations that start at the beginning of a comment line will be highlighted here.

php annotations use docBlock comments (documentation comment blocks, beginning with /** and ending with */) and the main use case for this syntax script is to contrast the regular annotations with any of them accidentally placed within simple comments, where they have no effect, so you can spot them easier.

If you find the highlighting annoying with your color scheme or with your annotations usage in php, you may use a command like
     :highlight link SpecialComment Number
to change the appearance (you can replace Number above with some other highlight group you may like), or you can disable the script with the
     :let g:php_annotations_syntax = 0
command in your .vimrc file.

If and when the main php syntax file provided with Vim ever gets updated to include annotations, this script will become obsolete.

That main file is getting quite old with all new php functions and classes added by every new php version; currently there are several newer alternatives on the Vim scripts site, but they like to replace, instead of extend, the main file provided by the distribution.

php-annotations-syntax's People

Contributors

terminatorul avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.