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

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

Expand Messages
  • Christian Wolfgang Hujer
    Hello dear list members, I have just encountered a strange behaviour when using abbreviations. I use vim 6.1.247 I have defined the following to abbreviations:
    Message 1 of 2 , Nov 3, 2002
    • 0 Attachment
      Hello dear list members,


      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.

      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>

      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"?>


      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.


      Greetings

      Christian
      --
      ITCQIS GmbH
      Christian Wolfgang Hujer
      Geschäftsführender Gesellschafter
      Telefon: +49 (0)89 27 37 04 37
      Telefax: +49 (0)89 27 37 04 39
      E-Mail: Christian.Hujer@...
      WWW: http://www.itcqis.com/
    • Bram Moolenaar
      ... It doesn t expand at all for me, just like
      Message 2 of 2 , Nov 3, 2002
      • 0 Attachment
        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
        abbreviations".

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