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

sh.vim: Fix detection of bash shSubSh(ells) instead of using shCmdParenRegion, and allow functions in shSubSh

Expand Messages
  • Dan Sanduleac
    Hi, I ve noticed that syntax highlighting inside bash subshells is lacking (comments are not rendered as such, for instance). Turns out that was because the
    Message 1 of 3 , May 15, 2014
      Hi,

      I've noticed that syntax highlighting inside bash subshells is lacking (comments are not rendered as such, for instance). Turns out that was because the subshells were parsed as `shCmdParenRegion` which is for stuff like `cat <<<(one-line command)`. Instead subshells should be parsed as `shSubSh`.

      I've also allowed function definitions to be contained in a shSubSh.

      Example to demonstrate:

      myfunction() {
      # This subshell is mistakenly parsed as shCmdParenRegion
      (
      # comments don't render
      # and this function definition isn't parsed as such
      foo() { true; }
      )

      # This was and should still be a shCmdParenRegion
      cat <<<(echo yes)
      }

      --
      --
      You received this message from the "vim_dev" 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_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • Charles Campbell
      ... Hello! Thank you for the patch and example. The foo() { true; } was still not highlighting properly as a function; so I made some additional changes.
      Message 2 of 3 , May 23, 2014
        Dan Sanduleac wrote:
        > Hi,
        >
        > I've noticed that syntax highlighting inside bash subshells is lacking (comments are not rendered as such, for instance). Turns out that was because the subshells were parsed as `shCmdParenRegion` which is for stuff like `cat <<<(one-line command)`. Instead subshells should be parsed as `shSubSh`.
        >
        > I've also allowed function definitions to be contained in a shSubSh.
        >
        > Example to demonstrate:
        >
        > myfunction() {
        > # This subshell is mistakenly parsed as shCmdParenRegion
        > (
        > # comments don't render
        > # and this function definition isn't parsed as such
        > foo() { true; }
        > )
        >
        > # This was and should still be a shCmdParenRegion
        > cat <<<(echo yes)
        > }
        >
        Hello!

        Thank you for the patch and example. The "foo() { true; }" was still
        not highlighting properly as a function; so I made some additional
        changes. Please try the attached syntax file.

        Regards,
        Chip Campbell

        --
        --
        You received this message from the "vim_dev" 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_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • Charles Campbell
        ... Sorry about that, everyone -- I apologize for sending that attachment to the entire list. Please, all: send your patches to the file s maintainer, not to
        Message 3 of 3 , May 23, 2014
          Charles Campbell wrote:
          > Dan Sanduleac wrote:
          >> Hi,
          >>
          >> I've noticed that syntax highlighting inside bash subshells is
          >> lacking (comments are not rendered as such, for instance). Turns out
          >> that was because the subshells were parsed as `shCmdParenRegion`
          >> which is for stuff like `cat <<<(one-line command)`. Instead
          >> subshells should be parsed as `shSubSh`.
          >>
          >> I've also allowed function definitions to be contained in a shSubSh.
          >>
          >> Example to demonstrate:
          >>
          >> myfunction() {
          >> # This subshell is mistakenly parsed as shCmdParenRegion
          >> (
          >> # comments don't render
          >> # and this function definition isn't parsed as such
          >> foo() { true; }
          >> )
          >>
          >> # This was and should still be a shCmdParenRegion
          >> cat <<<(echo yes)
          >> }
          >>
          > Hello!
          >
          > Thank you for the patch and example. The "foo() { true; }" was still
          > not highlighting properly as a function; so I made some additional
          > changes. Please try the attached syntax file.
          >
          > Regards,
          > Chip Campbell
          >
          Sorry about that, everyone -- I apologize for sending that attachment to
          the entire list. Please, all: send your patches to the file's
          maintainer, not to the list.

          Regards,
          Chip Campbell

          --
          --
          You received this message from the "vim_dev" 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_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        Your message has been successfully submitted and would be delivered to recipients shortly.