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

Re: Unintentional behavior of i< and a< text objects?

Expand Messages
  • James Vega
    ... This is based on the M flag of cpoptions . The vi-compatible behavior (M included in cpo ), is ignorant of backslash escapes and would do what you had
    Message 1 of 2 , Feb 5, 2010
    • 0 Attachment
      On Fri, Feb 5, 2010 at 10:12 AM, Ben Fritz <fritzophrenic@...> wrote:
      > I was editing a mapping I have that starts with <C-\><C-O>, and wanted
      > to change it to just <C-O>. So, I put my cursor on the first '-' and
      > typed, da< hoping to delete just <C-\>. I discovered that the
      > backslash acts as an escape character for the text object, and I ended
      > up deleting most of my buffer (until it found an unmatched >). No
      > harm, just had to press 'u', but the behavior surprised me.

      This is based on the M flag of 'cpoptions'. The vi-compatible behavior
      (M included in 'cpo'), is ignorant of backslash escapes and would do
      what you had expected. It might be useful to add a hint to this effect
      for the brace-like text-objects.

      > I understand the usefulness of escaping things like double quotes, but
      > I don't believe I've ever seen a syntax where '\' escapes a '>'. I
      > believe there are few where it also escapes a single quote. Perhaps
      > this is common code, though?

      Yes, it is. It's the findmatchlimit function in search.c and it honors
      the % and M flags for 'cpoptions'.

      --
      James
      GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan@...>

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