Loading ...
Sorry, an error occurred while loading the content.

Vim nesting syntax possible?

Expand Messages
  • Dirk.R.Gently@gmail.com
    Hello all. This I hope is an easy solution (possibly my yahoo ing isn t all it could be). If this is a complex task, I can look it up but I don t think itis.
    Message 1 of 2 , Mar 1, 2008
    • 0 Attachment
      Hello all. This I hope is an easy solution (possibly my yahoo'ing
      isn't all it could be). If this is a complex task, I can look it up
      but I don't think itis.

      I've put in a plugin called Vimpress. Vimpress comes with a syntax
      file that formats very basically the header the rest of the writing is
      done in html. How can I add the html syntax. Heres the vimpress
      syntax:

      " Vim syntax file
      " Language: PHP Templates (Solarphp, PHPSavant etc...)
      " Maintainer: Giuliani Sanches (giulianit at gmail dot com)
      " URL: http://giulianisanches.blogspot.com
      " Last Change: 2007 Novembro 20
      " Version: 0.1.2
      "
      "
      ###################################################################################################
      " Based on Armin Ronacher mako.vim syntax file (http://www.vim.org/
      scripts/script.php?script_id=1858)
      "
      ###################################################################################################
      "
      " For version 5.x: Clear all syntax items
      " For version 6.x: Quit when a syntax file was already loaded
      if version < 600
      syntax clear
      elseif exists("b:current_syntax")
      finish
      endif

      if !exists("main_syntax")
      let main_syntax = "html"
      endif

      "Source the html syntax file
      ru! syntax/html.vim
      unlet b:current_syntax

      "Put the php syntax file in @phpTop
      syn include @phpTop syntax/php.vim

      " Block rules
      syn region phpBlock start=#<?php# end=#?># keepend contains=@phpTop

      " Default highlighting links
      if version >= 508 || !exists("did_php_syn_inits")
      if version < 508
      let did_php_syn_inits = 1
      com -nargs=+ HiLink hi link <args>
      else
      com -nargs=+ HiLink hi def link <args>
      endif

      delc HiLink
      endif

      let b:current_syntax = "html"

      I've tried adding "syn include syntax/html.vim" but this will nullify
      the vimpress syntax. Any ideas?
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Benjamin Fritz
      ... A quick lookover makes it seem like it should already be working - the line ru! syntax/html.vim should do the trick so far as I know. Maybe it isn t
      Message 2 of 2 , Mar 3, 2008
      • 0 Attachment
        On 3/1/08, Dirk.R.Gently@... <Dirk.R.Gently@...> wrote:
        >
        > Hello all. This I hope is an easy solution (possibly my yahoo'ing
        > isn't all it could be). If this is a complex task, I can look it up
        > but I don't think itis.
        >
        > I've put in a plugin called Vimpress. Vimpress comes with a syntax
        > file that formats very basically the header the rest of the writing is
        > done in html. How can I add the html syntax. Heres the vimpress
        > syntax:
        >
        > " Vim syntax file
        > " Language: PHP Templates (Solarphp, PHPSavant etc...)
        > " Maintainer: Giuliani Sanches (giulianit at gmail dot com)
        > " URL: http://giulianisanches.blogspot.com
        > " Last Change: 2007 Novembro 20
        > " Version: 0.1.2
        > "
        > "
        > ###################################################################################################
        > " Based on Armin Ronacher mako.vim syntax file (http://www.vim.org/
        > scripts/script.php?script_id=1858)
        > "
        > ###################################################################################################
        > "
        > " For version 5.x: Clear all syntax items
        > " For version 6.x: Quit when a syntax file was already loaded
        > if version < 600
        > syntax clear
        > elseif exists("b:current_syntax")
        > finish
        > endif
        >
        > if !exists("main_syntax")
        > let main_syntax = "html"
        > endif
        >
        > "Source the html syntax file
        > ru! syntax/html.vim
        > unlet b:current_syntax
        >
        > "Put the php syntax file in @phpTop
        > syn include @phpTop syntax/php.vim
        >
        > " Block rules
        > syn region phpBlock start=#<?php# end=#?># keepend contains=@phpTop
        >
        > " Default highlighting links
        > if version >= 508 || !exists("did_php_syn_inits")
        > if version < 508
        > let did_php_syn_inits = 1
        > com -nargs=+ HiLink hi link <args>
        > else
        > com -nargs=+ HiLink hi def link <args>
        > endif
        >
        > delc HiLink
        > endif
        >
        > let b:current_syntax = "html"
        >
        > I've tried adding "syn include syntax/html.vim" but this will nullify
        > the vimpress syntax. Any ideas?

        A quick lookover makes it seem like it should already be working - the
        line "ru! syntax/html.vim" should do the trick so far as I know. Maybe
        it isn't working because of the "let main_syntax" statement above it?
        I'd suggest looking at the html.vim syntax file and seeing what might
        cause it to quit prematurely.

        Not sure if it will help, but this is somewhat related to the subject:

        http://vim.wikia.com/wiki/Different_syntax_highlighting_within_regions_of_a_file

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      Your message has been successfully submitted and would be delivered to recipients shortly.