--
Regards,
Van.
Hitting Ctrl-C in Insert mode goes back to Normal mode without
triggering InsertLeave. You can then call your function. I don't think
it's possible to go back into Insert mode afterwards without triggering
InsertEnter. Except, of course, in a Vim version built with -autocmd.
Best regards,
Tony.
--
Bypasses are devices that allow some people to dash from point A to
point B very fast while other people dash from point B to point A very
fast. People living at point C, being a point directly in between, are
often given to wonder what's so great about point A that so many people
from point B are so keen to get there and what's so great about point B
that so many people from point A are so keen to get _there_. They often
wish that people would just once and for all work out where the hell
they wanted to be.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
>
> On 10/01/09 10:08, Yue Wu wrote:
>> As title.
>>
>
> Hitting Ctrl-C in Insert mode goes back to Normal mode without
> triggering InsertLeave. You can then call your function. I don't think
> it's possible to go back into Insert mode afterwards without triggering
> InsertEnter. Except, of course, in a Vim version built with -autocmd.
>
Hmm, so it's not possible achieve in vimscript :(
I want to call the function when in insertmode and don't want to trigger
the insertLeave/Enter in vimscript.
--
Regards,
Van.
Wait, I've remembered something:
see
:help autocmd-disable
:help :noautocmd
:help 'eventignore'
Best regards,
Tony.
--
"I am not sure what this is, but an `F' would only dignify it."
-- English Professor
>
> Wait, I've remembered something:
>
> see
> :help autocmd-disable
> :help :noautocmd
> :help 'eventignore'
>
Still not so useful, because set them when in insert mode still need to use
<C-o> which will trigger event anyway.
Maybe I can define my own event and use them, is it possible?
--
Regards,
Van.
:h i_ctrl-r_=
--
Andy
You could disable them before getting into Insert mode.
As for defining one's own autocommand _event_, that's not possible
without patching the C code. (Defining auto_commands_ that trigger on
existing events is of course no problem; and you can trigger an event
out of turn by means of the ":doautocmd" command).
Best regards,
Tony.
--
Once there lived a village of creatures along the bottom of a
great crystal river. Each creature in its own manner clung tightly to
the twigs and rocks of the river bottom, for clinging was their way of
life, and resisting the current what each had learned from birth. But
one creature said at last, "I trust that the current knows where it is
going. I shall let go, and let it take me where it will. Clinging, I
shall die of boredom."
The other creatures laughed and said, "Fool! Let go, and that
current you worship will throw you tumbled and smashed across the
rocks, and you will die quicker than boredom!"
But the one heeded them not, and taking a breath did let go,
and at once was tumbled and smashed by the current across the rocks.
Yet, in time, as the creature refused to cling again, the current
lifted him free from the bottom, and he was bruised and hurt no more.
And the creatures downstream, to whom he was a stranger, cried,
"See a miracle! A creature like ourselves, yet he flies! See the
Messiah, come to save us all!" And the one carried in the current
said, "I am no more Messiah than you. The river delight to lift us
free, if only we dare let go. Our true work is this voyage, this
adventure.
But they cried the more, "Saviour!" all the while clinging to
the rocks, making legends of a Saviour.
>
> Yue Wu schrieb:
>> As title.
>>
>
> :h i_ctrl-r_=
>
No, it isn't what I want, for example, how do you avoid triggering
insertLeav/Enter to save current file via :w?
--
Regards,
Van.
>
> On 10/01/09 14:20, Yue Wu wrote:
>> On Sat, 10 Jan 2009 21:14:15 +0800, Tony Mechelynck wrote:
>>
>>> Wait, I've remembered something:
>>>
>>> see
>>> :help autocmd-disable
>>> :help :noautocmd
>>> :help 'eventignore'
>>>
>>
>> Still not so useful, because set them when in insert mode still need to
>> use
>> <C-o> which will trigger event anyway.
>>
>> Maybe I can define my own event and use them, is it possible?
>>
>
> You could disable them before getting into Insert mode.
It's not so easy and would get things mess up.
>
> As for defining one's own autocommand _event_, that's not possible
> without patching the C code. (Defining auto_commands_ that trigger on
> existing events is of course no problem; and you can trigger an event
> out of turn by means of the ":doautocmd" command).
For example, how to do to different the insertLeave triggered by <C-o> and
<ESC>?
>
>
> Best regards,
> Tony.
--
Regards,
Van.
you wanted to call a function iirc ...
a function can wrap any Ex command.
e.g.
func! FuncExec(cmd)
exec a:cmd
return ""
endfunc
imap <silent> <F2> <C-R>=FuncExec("w")<CR>
--
Andy
> func! FuncExec(cmd)
> exec a:cmd
> return ""
> endfunc
Wow, I didn't know it can be used in this way, thank you!
--
Regards,
Van.