Git Product home page Git Product logo

vim-syntax-for-php's Introduction

About

This is a fork of the official VIm syntax file for PHP (version from 2012-12-11 is bundled with VIm 7.4)

For now I just fix things I need and use daily.

See the commit log to see the changes from Jason Woofenden's version.

Install

Vundle

  1. Install and configure the Vundle plug-in manager, follow the instructions here

  2. Add the following line to your .vimrc:

     Plugin '2072/vim-syntax-for-PHP.git'
    
  3. Source your .vimrc with :so % or otherwise reload your VIm

  4. Run the :PluginInstall command

Pathogen

  1. Install the pathogen.vim plug-in, follow the instructions here

  2. Clone the repository under your ~/.vim/bundle/ directory:

     cd ~/.vim/bundle
     git clone [email protected]:2072/vim-syntax-for-PHP.git
    

vim-syntax-for-php's People

Contributors

2072 avatar 3onyc avatar blackikeeagle avatar blueyed avatar jasonwoof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vim-syntax-for-php's Issues

Broken syntax highlighting for phtml files

Hello!

Is there any way to get back syntax highlighting for phtml files?

For template files where we mix HTML and PHP with this plugin it's only either PHP or HTML syntax highlighted.

Using the "built-in" php.vim syntax file does it correctly.

Thanks!

switch-case indentation

Hello!

I'd like to ask what should I change in this file so I can get an indentation for the witch construct like this:

// [ ... ]
    switch($var) {
        case 'a':
            do_something();
        break;
        case 'b':
            do_whatever_else();
        break;
        default:
            default_action();
        break; // optional
    }

As you can see, the break statement indents back to the case level, which is consistent with the fact that it "ends" the case block. It is also similar to other php syntaxes: if (): / else: / endif; or for (): / endfor;, etc.

I know this is not "standard" (PSRx), and I'm thinking about proposing it :), but since it is not, I would like to modify the syntax file to get this indentation scheme.

May you help me on this? I'm not proficient in vim script (I'm learning, just wrote a function 2 weeks ago :D), much less syntax files. O:)

Thank you.

oddities with shorttag off

Found this by accident, after disabling shorttags parsing after working a rather large file that caused syntax parsing to take a few seconds...

shorttags not disabled (that is, the default)

image
(note that these are not short tags, but echo tags)

with php_noShortTags=1
image

with php_noShortTags=1, if I remove the <?php tag
image

or make the end tag ?> be on a line with code (doesn't have to be a single line with the opening <?php tag. that code block can be any size, only the closing tag matters to not be alone on its own line)
image

short tags are also fine in terms of not messing with the other echo tags
image

but having that php tag anywhere breaks the echo tags parsing
image

note that this doesn't change when editing file. E.g. if I load a file in a working state (i.e. without the bug happening), it won't trigger the bug as i edit file, even if i add <?php and ?> closing on its own line. Only after i save and quit and reopen the file (or save and :e!). Likewise if i open a file with the bug, removing the trigger won't fix it, until I reload the file. Whatever is causing it is "sticky".

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.