Skip to content

Support For PHP Files #2

Description

@hallzy

Thought I would bring this up, since a PHP file can have php, html, and anything that an HTML file can have.

In case you are not familiar with PHP, you have a PHP file (.php), but everything in it is actually HTML unless you have the PHP tags. For example:

<h1>Heading</h1>
<p>
    <?php
        $x = 5;
        echo $x;
    ?>
</p>

So basically, to make a PHP file work here, you would need something like this:

let g:context#commentstring#table.php = {
			\ 'javaScript'  : '// %s',
			\ 'phpRegion'   : '// %s',
			\ 'cssStyle'    : '/*%s*/',
			\}

However, because the contents of a .php file are html unless stated otherwise, we also need to override vim's default php commentstring (which is something like '/*%s*/'), to be the html commentstring.

So we also need something like this:

augroup phpCommentOverride
  autocmd!
  " Override PHP Comments
  autocmd FileType php setlocal commentstring=<!--\ %s\ -->
augroup END

If I add the above autocmd to my vimrc, and that new dictionary entry to your plugin it works for me... In my quick testing I couldn't build in the autocmd into your plugin for some reason though. I don't know why, but I could not get it to work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions