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

Bug in 'shellcmdflag' and proposed patch

Expand Messages
  • Gary Johnson
    I ve discovered a bug, or at least a limitation, in the behavior of the shellcmdflag option: it does not allow for multiple flags separated by spaces. I
    Message 1 of 2 , Jul 27, 2011
    • 0 Attachment
      I've discovered a bug, or at least a limitation, in the behavior
      of the 'shellcmdflag' option: it does not allow for multiple flags
      separated by spaces.

      I encountered this problem when trying to set the option like this,

      :set shellcmdflag=-O\ extglob\ -c

      so that I could use :grep with bash's extended pattern matching
      operators like this:

      :grep pattern !(*Foo*)

      That fails because Vim hands the contents of 'shellcmdflag' to bash
      as a single argument instead of three.

      The attached patch fixes this problem for Unix but not for other
      operating systems because I have no way to test my changes in
      environments other than Linux and Cygwin.

      The patch is to Vim 7.3.189. I haven't updated that particular Vim
      installation because I'm also trying to track down a race condition
      in the handling of the termresponse and diff events and I don't want
      to disturb the timing of those events.

      Setting 'shellcmdflag' to "-ic" is not a satisfactory solution
      because having bash source my ~/.bashrc when it's not in an
      interactive environment causes other problems.

      Regards,
      Gary

      --
      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
    • Bram Moolenaar
      ... Thanks. I ll await some people trying this out. -- ARTHUR: Well, I can t just call you `Man . DENNIS: Well, you could say `Dennis . ARTHUR: Well, I
      Message 2 of 2 , Jul 27, 2011
      • 0 Attachment
        Gary Johnson wrote:

        > I've discovered a bug, or at least a limitation, in the behavior
        > of the 'shellcmdflag' option: it does not allow for multiple flags
        > separated by spaces.
        >
        > I encountered this problem when trying to set the option like this,
        >
        > :set shellcmdflag=-O\ extglob\ -c
        >
        > so that I could use :grep with bash's extended pattern matching
        > operators like this:
        >
        > :grep pattern !(*Foo*)
        >
        > That fails because Vim hands the contents of 'shellcmdflag' to bash
        > as a single argument instead of three.
        >
        > The attached patch fixes this problem for Unix but not for other
        > operating systems because I have no way to test my changes in
        > environments other than Linux and Cygwin.
        >
        > The patch is to Vim 7.3.189. I haven't updated that particular Vim
        > installation because I'm also trying to track down a race condition
        > in the handling of the termresponse and diff events and I don't want
        > to disturb the timing of those events.
        >
        > Setting 'shellcmdflag' to "-ic" is not a satisfactory solution
        > because having bash source my ~/.bashrc when it's not in an
        > interactive environment causes other problems.

        Thanks. I'll await some people trying this out.

        --
        ARTHUR: Well, I can't just call you `Man'.
        DENNIS: Well, you could say `Dennis'.
        ARTHUR: Well, I didn't know you were called `Dennis.'
        DENNIS: Well, you didn't bother to find out, did you?
        The Quest for the Holy Grail (Monty Python)

        /// 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
      Your message has been successfully submitted and would be delivered to recipients shortly.