't' sound promising (you might want to add the below explanation or
something to the help file).
I'm trying to use the 't' key to funnel input to the ":" and "/"
prompt from inside a script.
I'm finding that using feedkeys() in conjunction with getchar() causes
Vim to hang in some loop:
let s:counter = 0
while 1
let s:counter += 1
echo "#" . s:counter . ":"
let inp = getchar()
if nr2char( inp ) != "" | let inp = nr2char( inp ) | endif
if inp == "\<ESC>" | break | endif
call feedkeys( inp, 't' )
redraw
endwhile
In this example, it waits for the first char, and then after that
"getchar()" returns immediately with the first char you entered,
forever and ever and ...
On 4/25/06, Yakov Lerner <[EMAIL PROTECTED]> wrote:
> On 4/25/06, Eric Arnold <[EMAIL PROTECTED]> wrote:
> > It isn't clear how the 't' mode is different from 'm'? I thought the
> > point of feedkeys() was that all the keys were to be used as typed by
> > a user?
>
> The difference between 'm' and 'n' is like difference between
> :norm and norm!. Keys coming from :norm and from feedkeys(,'m')
> are remapped, but not treated same was as coming from interactive
> user. For example, completion will not trigger.
>
> With 't', keys work same way as if coming from interactive user.
> For example completion will work. :norm and mapping
> are not capable of triggering completions. (Keys from
> map-expansions are marked as "noninteractive" keys).
>
> Yakov
>