On 08/16/10 05:50, coolesting wrote:

As we know, the abbreviation is expanded when we pressing the key<ENTER>,
<SPACE>, and<ESC>,

now , i want to just only press the key<ESC>  to expand it , how to setting
the vim ?

'iskeyword'

Unfortunately, Vim isn't really built for what you want to do without massively breaking stuff. According to the help:

"""
  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.
"""
  -- from ":help abbreviations"

That includes punctuation characters in addition to <enter> and <space>. So you'd have to add everything but <esc> to your list of 'isk' characters which breaks the expectations of lots of other things.

Alternatively, you can prefix those other characters with control+V to prevent Vim from expanding the abbreviation:

"""
  To avoid the abbreviation in insert mode: Type part of the
  abbreviation, exit insert mode with <Esc>, re-enter insert
  mode with "a" and type the rest.  Or type CTRL-V before the
  character after the abbreviation.
  To avoid the abbreviation in Command-line mode: Type CTRL-V
  twice somewhere in the abbreviation to avoid it to be
  replaced.  A CTRL-V in front of a normal character is mostly
  ignored otherwise.
"""
   -- from the same section of help

As an alternative to abbreviations (which don't seem to work like you want), you might look at using mappings instead.

Hope this gives you some ideas,

-tim



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