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

More windows quoting trouble

Expand Messages
  • Ben Fritz
    Try searching with :grep for a string containing a quote (as in
    Message 1 of 1 , Sep 14, 2013
    • 0 Attachment
      Try searching with :grep for a string containing a quote (as in http://superuser.com/questions/645157/vim-how-do-you-use-external-grep-to-search-for-quotation-marks)

      Either the grep command given in that post, or the following:

      :!findstr \"foo test.txt

      For some reason, it appears that "findstr" consumes the " so unlike any other command in Windows '\' is the escape character.

      This search doesn't work with shellxquote set to either ( or "(. In both cases the shell returns 1 for no results.

      It works with shellxquote set to ", or set to empty.

      The corresponding :grep \" test.txt only seems to work with shellxquote set to ".

      Anyway, some experimentation in the cmd.exe shell shows that "( ought to work, but for some reason the " isn't being escaped according to shellxescape:

      C:\Users\Ben\AppData\Local\Temp>cmd /c "(findstr \^"jkl test.txt)"
      "jkl

      :!findstr \"jkl test.txt
      C:\Windows\system32\cmd.exe /c "(findstr \"jkl test.txt)"
      shell returned 1

      Regardless, I can't figure out how we could get the default value of ( to work:
      C:\Users\Ben\AppData\Local\Temp>cmd /c (findstr \^"jkl test.txt)

      C:\Users\Ben\AppData\Local\Temp>cmd /c (findstr \"jkl test.txt)

      C:\Users\Ben\AppData\Local\Temp>cmd /c (findstr \^^"jkl test.txt)
      "jkl




      Is there a reason why " isn't escaped when shellxquote is "(? If it were escaped with ^, then the search should work.

      Also I don't recall, why isn't "( the default?

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