On 19/01/11 04:59, Jean-Francois wrote:
Hi,

I use the following abbrev but I don't understand why it inserts a
space between ' and .html so I got {% extends ' .html' %}

iab ,ex, {% extends '.html' %}<ESC>hhhhhhhhi


Thanks for your help !


,ex, (comma small-e small-x comma) is a non-id abbreviation. As defined above, it inserts

        {% extends '.html %}

and puts the cursor in Insert mode before the dot. Now what happens depends on how you triggered the abbreviation: - if you typed a non-keyword printable character (such as a space) that character will trigger the abbreviation, but it will not be consumed, and it'll end up being inserted at the cursor (between the opening quote and the dot). - if you typed Ctrl-] it will trigger the abbreviation and it will also be consumed, and you'll end up in Insert mode with the cursor between the opening quote and the dot, with no space on either side of the cursor - if you type <Esc> it will end Insert mode and move the cursor one screen cell left, and you'll end up in Normal mode with the cursor on the opening quote. - if you hit <Enter> it'll break the line between the opening quote and the dot
- And so on...

But the abbreviation can only be triggered by a non-keyword character. With that abbreviation defined, if you type just

        ,ex,index

the abbreviation won't be expanded.

See ":help abbreviations" from which I extract the following paragraph:

An abbreviation is only recognized when you type a non-keyword character.
This can also be the <Esc> that ends insert mode or the <CR> that ends a
command.  The non-keyword character which ends the abbreviation is inserted
after the expanded abbreviation.  An exception to this is the character <C-]>,
which is used to expand an abbreviation without inserting any extra
characters.


Best regards,
Tony.
--
"Arguments with furniture are rarely productive."
                -- Kehlog Albran, "The Profit"

--
You received this message from the "vim_use" 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

Reply via email to