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

[BUG] “:*do {block} 1 | echo 1” do not throw any errors or even ask for input

Expand Messages
  • ZyX
    The following script will echo 1 three times without any errors in place of complaining about missing endif: vim -u NONE 1 2 3 -c bufdo while 1 | echo 1 .
    Message 1 of 6 , Mar 20, 2014
    • 0 Attachment
      The following script will echo 1 three times without any errors in place of complaining about missing endif:

      vim -u NONE 1 2 3 -c 'bufdo while 1 | echo 1'

      . The following script will ask user three times for endif:

      vim -u NONE 1 2 3 -s <(echo ':bufdo if 1 | echo 1')

      .

      --
      --
      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.
    • Andre Sihera
      ... I think you meant: vim -u NONE 1 2 3 -c bufdo if 1 | echo 1 doesn t complain about the missing endif . As it happens, the while example doesn t
      Message 2 of 6 , Mar 20, 2014
      • 0 Attachment
        On 21/03/14 07:34, ZyX wrote:
        > The following script will echo 1 three times without any errors in place of complaining about missing endif:
        >
        > vim -u NONE 1 2 3 -c 'bufdo while 1 | echo 1'
        >

        I think you meant:

        vim -u NONE 1 2 3 -c 'bufdo if 1 | echo 1'


        doesn't complain about the missing "endif". As it happens, the "while"
        example
        doesn't complain either.

        --
        --
        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.
      • Andre Sihera
        ... Isn t this to do with the fact that
        Message 3 of 6 , Mar 20, 2014
        • 0 Attachment
          On 21/03/14 07:34, ZyX wrote:
          > The following script will echo 1 three times without any errors in place of complaining about missing endif:
          >
          > vim -u NONE 1 2 3 -c 'bufdo while 1 | echo 1'
          >
          > . The following script will ask user three times for endif:
          >
          > vim -u NONE 1 2 3 -s<(echo ':bufdo if 1 | echo 1')
          >
          > .
          >
          Isn't this to do with the fact that "<(...)" causes the shell to create
          a temporary file
          which is then sourced by ViM, and in ViM, all block constructs must be
          terminated
          by the end of the current file, therwise an error occurs.

          "-c" on the other hand simply executes an Ex command as if it had been
          entered
          interactively by the user. There is no file scope therefore there is no
          error output if
          the end of the block is missing.

          To me it looks like ViM is working normally here.

          Cheers,

          --
          --
          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.
        • ZyX
          ... This or “in place of complaining about endwhile”, does not matter. Title says about block commands, you will have the same result with :try. Not
          Message 4 of 6 , Mar 20, 2014
          • 0 Attachment
            > I think you meant:
            >
            > vim -u NONE 1 2 3 -c 'bufdo if 1 | echo 1'
            >
            > doesn't complain about the missing "endif". As it happens, the "while"
            > example
            > doesn't complain either.

            This or “in place of complaining about endwhile”, does not matter. Title says about block commands, you will have the same result with :try. Not :function though, it always falls to the second variant. Not surprising since it is more similar to :append then to real block commands.

            --
            --
            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.
          • ZyX
            ... It does not. It is =(...) that uses temporary files (assuming you use zsh),
            Message 5 of 6 , Mar 20, 2014
            • 0 Attachment
              > Isn't this to do with the fact that "<(...)" causes the shell to create
              > a temporary file

              It does not. It is =(...) that uses temporary files (assuming you use zsh), <(...) creates file descriptors before forking and attaches them to ...’s stdout.

              > which is then sourced by ViM, and in ViM, all block constructs must be
              > terminated
              > by the end of the current file, therwise an error occurs.

              Error?! Where have you seen a word about *occurring* error?

              Originally I checked this on a running vim by *typing* :bufdo if 1.

              >
              > "-c" on the other hand simply executes an Ex command as if it had been
              > entered
              > interactively by the user. There is no file scope

              `-s` is not regular sourcing. There is a thing which you may call “file scope”: implementation-defined differences in Ex commands handling (e.g. line continuation working only in files), but this has nothing to do with -s: it feeds input like if it was typed.

              > therefore there is no
              > error output if
              > the end of the block is missing.

              :h :execute, third-last paragraph:

              > Note: The executed string may be any command-line, but
              > you cannot start or end a "while", "for" or "if"
              > command. Thus this is illegal: >
              > :execute 'while i > 5'
              > :execute 'echo "test" | break'

              . Even though with :execute it works it is explicitly marked as illegal. Will you say :execute has file scope?

              // Note about “works”:

              execute 'if '.condition

              works like

              if eval(condition)

              , be it in file or not: i.e. it expects endif in the following lines.

              >
              > To me it looks like ViM is working normally here.

              --
              --
              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.
            • Bram Moolenaar
              ... I suppose it s better to give an error and abort. ... A bit strange, but since this is handled as if the user typed it, prompting the user is OK. -- CART
              Message 6 of 6 , Mar 22, 2014
              • 0 Attachment
                ZyX wrote:

                > The following script will echo 1 three times without any errors in
                > place of complaining about missing endif:
                >
                > vim -u NONE 1 2 3 -c 'bufdo while 1 | echo 1'

                I suppose it's better to give an error and abort.

                > . The following script will ask user three times for endif:
                >
                > vim -u NONE 1 2 3 -s <(echo ':bufdo if 1 | echo 1')

                A bit strange, but since this is handled as if the user typed it,
                prompting the user is OK.

                --
                CART DRIVER: Bring out your dead!
                There are legs stick out of windows and doors. Two MEN are fighting in the
                mud - covered from head to foot in it. Another MAN is on his hands in
                knees shovelling mud into his mouth. We just catch sight of a MAN falling
                into a well.
                "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

                /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                \\\ an exciting new programming language -- http://www.Zimbu.org ///
                \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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