Re: Hey everyone! Two pathces to syntax files.
Peter Hodge wrote:
No - I want HTM files treated as HTML files like they are supposed to be treated. But PHP code can reside within HTML files. My change allows HTML files to act like HTML files but it also makes the PHP within it act like PHP code. There is a difference. :-)
--- On Fri, 25/9/09, Mark Manning <markem@...> wrote:
From: Mark Manning <markem@...> Subject: Re: Hey everyone! Two pathces to syntax files. To: vim_dev@... Received: Friday, 25 September, 2009, 11:02 PM So to put this in to perspective - the PHP code does generate HTML code (or just data) and that is inserted into the HTML code. I'm just using the ".htm" extension so Dreamweaver will display it properly as well and allow me to change things in it. This is why I made the change. Now the PHP.vim file correctly does the coloration even if the source code is in an HTML file. Which it wasn't doing before for me.
If you just wanted to have .htm files treated as PHP files, all you need to do is add filetype detection in your .vimrc: autocmd! filetypedetect *.htm setfiletype php regards, Peter
PHP code, whether it is contained within HTML, VBScript, C/C++, COBOL, FORTRAN, or any other language should still look like PHP code when viewed within VIM. Mine was all green, red, and other colors associated with some other language's color scheme. My simple change makes that go away and instead I now see the PHP code like it should be seen (as well the HTML, VBScript, et al). The HTML.vim file did not add in the PHP code because the PHP code adds in the HTML.vim syntax file. Thus causing a circular reference. By adding in the little bit of code I have to the PHP.vim and HTML.vim files the circular reference is short circuited and the PHP.vim file can now be safely added to the HTML.vim file. So now, if you happen to have an HTML file that contains PHP code - you see it properly syntax highlighted. More importantly - you also still see the HTML file properly highlighted even if you do not have PHP included in your HTML file.
I believe it is a good set of patches (at least, I like to see my PHP code correctly highlighted). Do you have a problem with what I submitted? If so, could you post why? If you have a valid reason for not wanting the change - then I see no reason for you to change the code. But if you do not have a valid reason then I think you should add in the change so others might enjoy the benefit of being able to see their PHP code highlighted properly. :-)
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php