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

Re: Strange ab behavior (perhaps a bug), suggestions for ab

Expand Messages
  • Bram Moolenaar
    ... It doesn t expand at all for me, just like
    Message 1 of 2 , Nov 3, 2002
      Christian Wolfgang Hujer wrote:

      > I have just encountered a strange behaviour when using abbreviations.
      > I use vim 6.1.247
      > I have defined the following to abbreviations:
      > ab <a <a href=""></a><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT>
      > ab <li> <li></li><LEFT><LEFT><LEFT><LEFT><LEFT>
      > When I type <li>< it expands to <li><|</li> where the cursor's position is
      > marked with |.
      > Now when I type a followed by a space, the sum of both ab's does not expand,
      > as I'd expect, to
      > <li><a href=" |"></a></li>
      > but to
      > <li<a href=" |"></a></li>
      > So the > of <li> is missing, it vanishes.

      It doesn't expand at all for me, just like "><a " doesn't expand.
      That's because abbreviations only work for whole words, not when there
      is something before it. Perhaps you have < and > in 'iskeyword'?

      > If I use these abbreviations alone, they work fine. Only when using one right
      > after another they do not work.
      > You might also try typing <li><li><li><li> followed by a space and see what
      > happens:
      > <li> </li></li></li></li>
      > is the result insetad of
      > <li><li><li><li> </li></li></li></li>

      I do get the expected result. Can't guess why it works wrong for you.

      > Is this a bug or did I miss the point with these abbreviations?
      > Some versions ago they worked, by the way.
      > Something else:
      > Why is the following ab not possible:
      > ab <?xml <?xml version="1.0" encoding="utf-8"?>
      > but the following are possible:
      > ab <a <a href=""></a><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT>
      > ab <?xml> <?xml version="1.0" encoding="utf-8"?>
      > ab <?xml?> <?xml version="1.0" encoding="utf-8"?>

      Do read the part about full-id and non-id types. It's at ":help

      > Third topic:
      > I suggest a new extension for abbreviations.
      > <CURSOR>
      > with :ab <a <a href="<CURSOR>"></a> the cursor should be at the
      > <CURSOR>-position after the abbreviation is expanded.

      That's not really what abbreviations were to be used for. You can use a
      mapping and/or a function instead.

      It is illegal to rob a bank and then shoot at the bank teller with a water
      [real standing law in Louisana, United States of America]

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\
      \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
      \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
    Your message has been successfully submitted and would be delivered to recipients shortly.