On 17/08/10 12:51, Tim Chase wrote:
On 08/17/10 04:37, coolesting wrote:
" a abbreviation in .vimrc file
:ab php <?php ?>

" a ex command-line will be issue in vim
:newtab /var/www/index.php

so, it is not work as i expected when issue the ex command
and press the ENTER key, the word "php" at the end of ex
command sequence will be expanded the "<?php ?>".

As Bill has suggested, to prevent this expansion in the command-line,
use ":iab" ("insert-mode abbreviation") instead of ":ab".

when i type the string just like the abbreviation, sometimes ,
we need to comment the code with some words, you maybe type a
word as your abbreviation, if you need the press<enter> or
<space> in which the comment, now ,what solution you have,
how to do you will ?

This is one of the reasons I don't often use abbreviations. :) For them
to be useful, they have to be unique stretches of text or you have to
remember to press control-V to break the abbreviation. I usually throw
some 'isk' character into my LHS such as

:iab _P <?php ?>

to (1) make it something I'm not likely to type unintentionally and (2)
to minimize the number of keystrokes (including <shift> going up/down)
while remaining memorable enough that I actually use it. So I usually
only use abbreviations when there are long stretches of prose with long
& frequently repeated phrases (such as the full name or a person or
company).

-tim

PS: lamenting that "abbreviation" is such a long word...

Yes, using php as the {lhs} of an abbreviation is a bad choice because you will sometimes want to type (even in insert mode) a filename with .php at the end. So, in addition to Tim's _P, here are a few more possibilities:

        iab phq <?php?>
                " you wouldn't want to type "phq" as text would you?
        iab phq <?php?><Left><Left>
                " if there are possible arguments there as in <?xml?>
        iab phf <?php?>
                " for PHp File
        iab phh <?php?>
                " for PHp Header
        iab ?p <?php?>
                " using an «end-id» abbreviation

Best regards,
Tony.
--
People need good lies.  There are too many bad ones.
                -- Bokonon, "Cat's Cradle" by Kurt Vonnegut, Jr.

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