Ravi Shankar Sivaraman <rsivara1@...
> I got some problems with imap.
> I did a imap something like this :
> imap < <C-O>:call somefunction()
> When the user presses "<", this function gets called. According to
> the user this is one single insert operation. But when he repeats the
> previous insert (by pressing "."), only the text inserted by the
> somefunction() is repeated. This is because of the <C-O> which
> swichtes to command mode and executes the function and returns back
> to insert mode. But I want the changes before the <C-O> and after
> that to be available as one "previous" insert. How to do that? So to
> the user it all looks like one insert operation, though there are two
> successive insert operations are happening.
> Or is it possible to call a function from insert mode itself(without
> explicitly going to command mode), so that the "." can function
> properly? I guess this should be a common problem with imap. Any help?
> - Ravi
Change the function to "return" the thing-to-insert. Then use the expression
(I haven't tested it.)