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

Re: Incorrect syntax highlight of things like '\r' within EOF block in bash script

Expand Messages
  • John Little
    ... Are you asking how to apply tex syntax highlighting to a script embedded in a bash script? Perhaps:
    Message 1 of 8 , Jul 18, 2013
    • 0 Attachment
      On Thursday, 18 July 2013 08:02:02 UTC+12, Peng Yu wrote:
      >
      > vim can not syntax highlight the following script correctly...

      Are you asking how to apply tex syntax highlighting to a script embedded in a bash script? Perhaps:

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

      can help, or, more likely, the TeX and LaTex people will help; I suggest putting "TeX" in the subject would have been a good idea.

      Regards, John Little

      --
      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Charles E Campbell
      ... May I suggest that you.. Read :help sh-embed Modify the example to do LaTeX: TEX Embedding: {{{1 ============== Shamelessly ripped from aspperl.vim
      Message 2 of 8 , Jul 18, 2013
      • 0 Attachment
        Peng Yu wrote:
        > Hi,
        >
        > vim can not syntax highlight the following script correctly. Does
        > anybody know a better highlight plugin that can correct highlight it?
        >
        May I suggest that you..

        Read :help sh-embed

        Modify the example to do LaTeX:

        " TEX Embedding: {{{1
        " ==============
        " Shamelessly ripped from aspperl.vim by Aaron Hope.
        if exists("b:current_syntax")
        unlet b:current_syntax
        endif
        syn include @TEXScript syntax/tex.vim
        syn region TEXScriptCode matchgroup=TEXCommand start=+[=\\]\@<!'+
        skip=+\\'+ end=+'+ contains=@TEXScript contained
        syn region TEXScriptEmbedded matchgroup=TEXCommand start=+\<tex\>+
        skip=+\\$+ end=+[=\\]\@<!'+me=e-1 contains=@shIdList,@shExprList2
        nextgroup=TEXScriptCode
        syn cluster shCommandSubList add=TEXScriptEmbedded
        hi def link TEXCommand Type
        syn region shHereDoc matchgroup=shRedir20 start="<<\s*\\\=\z([^
        \t|]*\)" matchgroup=shRedir20 end="^\z1\s*$"
        contains=@shDblQuoteList,@TEXScript

        I identified which shHereDoc to recognize (ie. the one with shRedir20)
        by using :HLT! and moving the cursor into the block. :HLT is provided
        courtesy of my hilinks.vim plugin, available at my website as:
        http://www.drchip.org/astronaut/vim/index.html#HILINKS

        Regards,
        Chip Campbell

        --
        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Gary Johnson
        ... That s not the problem, as I understand it. The problem is that Vim incorrectly highlights the r and the e differently than the rest of the here
        Message 3 of 8 , Jul 18, 2013
        • 0 Attachment
          On 2013-07-18, John Little wrote:
          > On Thursday, 18 July 2013 08:02:02 UTC+12, Peng Yu wrote:
          > >
          > > vim can not syntax highlight the following script correctly...
          >
          > Are you asking how to apply tex syntax highlighting to a script
          > embedded in a bash script?

          That's not the problem, as I understand it. The problem is that Vim
          incorrectly highlights the "\r" and the "\e" differently than the
          rest of the here document, suggesting that bash treats them
          differently, perhaps as carriage-return and escape, when in fact
          bash does not treat those pairs differently than the individual
          characters they comprise.

          Regards,
          Gary

          --
          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        Your message has been successfully submitted and would be delivered to recipients shortly.