I'll put in a plug for my GetChar event patch, which would allow this :-)



On 6/22/06, Hari Krishna Dara <[EMAIL PROTECTED]> wrote:

On Thu, 22 Jun 2006 at 5:36pm, Jason Frerich wrote:

> How can I tell the search '/' command to perform a task after typing
> each letter on the pattern line.
>
> For Example:
> /g0ee
> I would like the above to execute as the following:
> /g - sendcommand(g)
>  0 - sendcommand(g0)
>  e - sendcommand(g0e)
>  e - sendcommand(g0ee)
>
> After each letter is typed, I would like to send that letter(s) to a
> function call "sendcommand".
>
> Jason

I can't think of a simple way to capture all keys without mapping all
possible keys, something like:

for ch in range(32, 126)
  exec 'nnoremap <expr>' nr2char(ch) 'sendcommand('.nr2char(ch).')'
endfor

Inside sendcommand() you should check the mode, something like:

function sendcommand(ch)
  if getcmdtype() == '/'
    " do something
  endif
  return a:ch
endfunction

If this is not acceptable to you, you can map / to trigger your function
which will read the keys using getchar(). You will have to implement at
least a sub set of editing mode keys. Take a look at my execmap.vim
plugin that does this.

--
HTH,
Hari

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Reply via email to