On Sun, Oct 29, 2006 at 01:38:36PM +0200, Yakov Lerner wrote:
> How can I make mapping or abbrev that behaves as follows:
> when I type "echo " (echo<space>) and I type nothing else within
> 1 second, it adds '"' (so it becomes 'echo "'). If I continue typing
> quickly after 'echo ', then ["] is not added. I'm sure it's possible.
> 
> Yakov

     Untested:  use an abbreviation that defines two autocommands:

:augroup Hack
:au CursorHoldI * execute "normal a\"\<Esc>"
:au CursorHoldI,InsertLeave,CursorMovedI * au! Hack
:agroup END

What I did test is that CursorMovedI is triggered when you insert a
character.  Thus both autocommands are cleared after 'updatetime' or the
first typed character (or cursor movement or leaving Insert mode).  I am
not sure whether the :normal command will work.  Of course, you can also
have the abbreviation change &updatetime and have the autocommands
restore it.

HTH                                     --Benji Fisher

Reply via email to