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

Bug in command parsing

Expand Messages
  • Fj
    Hi, I found this strange thing that probably isn t very important, but still. Also it might be not a bug, but really misguided feature. Suppose you have a file
    Message 1 of 2 , Sep 30, 2009
    • 0 Attachment
      Hi, I found this strange thing that probably isn't very important, but
      still. Also it might be not a bug, but really misguided feature.

      Suppose you have a file named `\` (backslash). On Linux. You want to
      edit it, OK, `:e \\` works perfectly (and that's what autocomplete
      proposes, btw). `:e \\\` and `:e \\\\` both try to edit "two
      backslashes".

      Now you want to edit a file and then do something else.
      `:e \\ | echo 'x'` produces E172: Only one file name allowed
      `:e \\| echo 'x'` edits file `| echo 'x'`
      `:e \\\ | echo 'x'` edits file `\ `, as it's supposed to.
      `:e \\\| echo 'x'` edits file `\| echo 'x'`
      And so on. Also, changing `echo 'x'` to `echo "x"` changes some of the
      behaviours...

      So, how do I edit a file called Backslash? And is it really a bug, or
      just Vim trying to be too clever?

      :version
      VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Sep 7 2009 15:26:14)
      Included patches: 1-245

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Tony Mechelynck
      ... The :exe[cute] statement wraps is operands the way :echo does, but executes the resulting expression(s) as an Ex-command-line (separating them by a
      Message 2 of 2 , Oct 31, 2009
      • 0 Attachment
        On 30/09/09 18:50, Fj wrote:
        >
        > Hi, I found this strange thing that probably isn't very important, but
        > still. Also it might be not a bug, but really misguided feature.
        >
        > Suppose you have a file named `\` (backslash). On Linux. You want to
        > edit it, OK, `:e \\` works perfectly (and that's what autocomplete
        > proposes, btw). `:e \\\` and `:e \\\\` both try to edit "two
        > backslashes".
        >
        > Now you want to edit a file and then do something else.
        > `:e \\ | echo 'x'` produces E172: Only one file name allowed
        > `:e \\| echo 'x'` edits file `| echo 'x'`
        > `:e \\\ | echo 'x'` edits file `\ `, as it's supposed to.
        > `:e \\\| echo 'x'` edits file `\| echo 'x'`
        > And so on. Also, changing `echo 'x'` to `echo "x"` changes some of the
        > behaviours...
        >
        > So, how do I edit a file called Backslash? And is it really a bug, or
        > just Vim trying to be too clever?
        >
        > :version
        > VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Sep 7 2009 15:26:14)
        > Included patches: 1-245

        :exec 'e \' | echo 'Hello World!'

        The ":exe[cute]" statement wraps is operands the way ":echo" does, but
        executes the resulting expression(s) as an Ex-command-line (separating
        them by a single space, the way ":echo" does, into a single ex-command
        if there are more than one expression) instead of displaying them, and
        it can be followed by a | and more ex-commands on the same line. One
        particularity of ":exe" (and ":echo", I think) is that if you want to
        write a Vim-comment after it on the same line you must prefix it by |"
        (vertical-bar double-quote) not just " (double-quote).


        Best regards,
        Tony.
        --
        Mathematicians often resort to something called Hilbert space, which is
        described as being n-dimensional. Like modern sex, any number can
        play.
        -- Dr. Thor Wald, in "Beep/The Quincunx of Time", by
        James Blish

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