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

bash syntax highlighting glitch

Expand Messages
  • Dan Stromberg
    I have a large bash script that has a fi highlighted in red. I rely on the syntax highlighting to help me catch errors early. However, in this case, I
    Message 1 of 7 , Feb 19, 2008
      I have a large bash script that has a "fi" highlighted in red.

      I rely on the syntax highlighting to help me catch errors early.

      However, in this case, I suspect the highlighting is incorrect.

      Is there a way of fixing it?

      I suspect the file itself is correct and the highlighting is incorrect,
      because:

      1) gvim 7.1 (the one that comes with openSUSE 10.3) shows the
      highlighting is fine
      2) vim 7.1 (the one that comes with openSUSE 10.3) shows the "fi" is in
      error
      3) A vim 7.1 I built from sources shows the "fi" is in error
      4) The script itself seems to run fine
      5) If I copy the large if out of the larger script into a file by itself,
      vim believes the smaller file is fine
      6) If, in vim 7.1, I control-B to the beginning of the if, and then
      control-F back to the end of the if, the "fi" is no longer in red. It's
      only when I do a search to that "fi" that I see the mistaken highlighting

      It is a pretty large if/fi - is there some sort of limit on how far back
      in a file vim will search for a matching if?

      Thanks!


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Tim Chase
      ... This may be the problem... ... Vim does only scan back a certain number of lines to optimize redrawing (if you ve got a 4-gig file, and are editing at the
      Message 2 of 7 , Feb 19, 2008
        > It is a pretty large if/fi - is there some sort of limit on how far back
        > in a file vim will search for a matching if?


        This may be the problem...

        :help :syn-sync

        Vim does only scan back a certain number of lines to optimize
        redrawing (if you've got a 4-gig file, and are editing at the
        bottom, you don't want to scan from the beginning of the file
        unless you *ABSOLUTELY* need to :)

        Typing

        :syn sync

        will tell you what the minlines/maxlines are for synchronizing
        colorization (perhaps with extra info). You might try bumping up
        that range, or changing the sync method to one of the
        alternatives (there are 4 methods described at the above help)

        -tim




        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Dan Stromberg
        ... Increasing my sh_minlines in the relevant syntax file (syntax/sh.vim) helped. --~--~---------~--~----~------------~-------~--~----~ You received this
        Message 3 of 7 , Feb 19, 2008
          On Tue, 19 Feb 2008 19:16:02 +0000, Dan Stromberg wrote:

          > I have a large bash script that has a "fi" highlighted in red.
          >
          > I rely on the syntax highlighting to help me catch errors early.
          >
          > However, in this case, I suspect the highlighting is incorrect.
          >
          > Is there a way of fixing it?
          >
          > I suspect the file itself is correct and the highlighting is incorrect,
          > because:
          >
          > 1) gvim 7.1 (the one that comes with openSUSE 10.3) shows the
          > highlighting is fine
          > 2) vim 7.1 (the one that comes with openSUSE 10.3) shows the "fi" is in
          > error
          > 3) A vim 7.1 I built from sources shows the "fi" is in error 4) The
          > script itself seems to run fine 5) If I copy the large if out of the
          > larger script into a file by itself, vim believes the smaller file is
          > fine 6) If, in vim 7.1, I control-B to the beginning of the if, and then
          > control-F back to the end of the if, the "fi" is no longer in red. It's
          > only when I do a search to that "fi" that I see the mistaken
          > highlighting
          >
          > It is a pretty large if/fi - is there some sort of limit on how far back
          > in a file vim will search for a matching if?
          >
          > Thanks!
          >
          >
          >
          Increasing my sh_minlines in the relevant syntax file (syntax/sh.vim)
          helped.


          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Charles E. Campbell, Jr.
          ... Perhaps -- but modifying the system file (if that s what you did) isn t the best way to do it. For bash/ksh/sh: put let sh_minlines= 1000 in your
          Message 4 of 7 , Feb 19, 2008
            Dan Stromberg wrote:

            >On Tue, 19 Feb 2008 19:16:02 +0000, Dan Stromberg wrote:
            >
            >
            >
            >>I have a large bash script that has a "fi" highlighted in red.
            >>
            >>I rely on the syntax highlighting to help me catch errors early.
            >>
            >>However, in this case, I suspect the highlighting is incorrect.
            >>
            >>Is there a way of fixing it?
            >>
            >>I suspect the file itself is correct and the highlighting is incorrect,
            >>because:
            >>
            >>1) gvim 7.1 (the one that comes with openSUSE 10.3) shows the
            >>highlighting is fine
            >>2) vim 7.1 (the one that comes with openSUSE 10.3) shows the "fi" is in
            >>error
            >>3) A vim 7.1 I built from sources shows the "fi" is in error 4) The
            >>script itself seems to run fine 5) If I copy the large if out of the
            >>larger script into a file by itself, vim believes the smaller file is
            >>fine 6) If, in vim 7.1, I control-B to the beginning of the if, and then
            >>control-F back to the end of the if, the "fi" is no longer in red. It's
            >>only when I do a search to that "fi" that I see the mistaken
            >>highlighting
            >>
            >>It is a pretty large if/fi - is there some sort of limit on how far back
            >>in a file vim will search for a matching if?
            >>
            >>Thanks!
            >>
            >>
            >>
            >>
            >>
            >Increasing my sh_minlines in the relevant syntax file (syntax/sh.vim)
            >helped.
            >
            >
            Perhaps -- but modifying the system file (if that's what you did) isn't
            the best way to do it.
            For bash/ksh/sh: put let sh_minlines= 1000 in your <.vimrc>. (or
            whatever qty of lines you prefer).

            Regards,
            Chip Campbell


            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Ben Schmidt
            ... I d love to see a 4 GB shell script... Actually, I wouldn t! Chuckles, Ben. Send instant messages to your online friends http://au.messenger.yahoo.com
            Message 5 of 7 , Feb 19, 2008
              > Vim does only scan back a certain number of lines to optimize
              > redrawing (if you've got a 4-gig file, and are editing at the
              > bottom, you don't want to scan from the beginning of the file
              > unless you *ABSOLUTELY* need to :)

              I'd love to see a 4 GB shell script...

              Actually, I wouldn't!

              Chuckles,

              Ben.




              Send instant messages to your online friends http://au.messenger.yahoo.com


              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Richard Hartmann
              On Wed, Feb 20, 2008 at 7:22 AM, Ben Schmidt ... I read that the bible has 5 MB.. No idea idea if that is true and I don t even care, but it seemed to fit the
              Message 6 of 7 , Feb 20, 2008
                On Wed, Feb 20, 2008 at 7:22 AM, Ben Schmidt
                <mail_ben_schmidt@...> wrote:


                > I'd love to see a 4 GB shell script...

                I read that the bible has 5 MB.. No idea idea if that is true and
                I don't even care, but it seemed to fit the topic at hand :)


                Richard

                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • Ben Schmidt
                ... Mine is about 4 MB in English, nearly 8 MB in original languages (UTF-8 including diacritics--only about 3 million characters). And yes, I mostly view my
                Message 7 of 7 , Feb 20, 2008
                  Richard Hartmann wrote:
                  > On Wed, Feb 20, 2008 at 7:22 AM, Ben Schmidt
                  > <mail_ben_schmidt@...> wrote:
                  >
                  >
                  >> I'd love to see a 4 GB shell script...
                  >
                  > I read that the bible has 5 MB.. No idea idea if that is true and
                  > I don't even care, but it seemed to fit the topic at hand :)

                  Mine is about 4 MB in English, nearly 8 MB in original languages (UTF-8 including
                  diacritics--only about 3 million characters). And yes, I mostly view my Bible in Vim.

                  Smiles,

                  Ben.




                  Send instant messages to your online friends http://au.messenger.yahoo.com


                  --~--~---------~--~----~------------~-------~--~----~
                  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.