On Wed, Apr 26, 2006 at 11:18:35AM -0400, David Fishburn wrote:
>
> I am using vim70f on WinXP SP2.
>
> function! sqlcomplete#DrillIntoTable()
> if pumvisible()
> exec "normal! i\<C-Y>"
> " call sqlcomplete#Map('column')
> call feedkeys("\<C-X>\<C-O>")
> endif
> return ""
> Endfunction
>
> imap <buffer> <c-right> <C-R>=sqlcomplete#DrillIntoTable()<CR>
>
> When the omni popup is visible, to get the current selected item you must
> press <C-Y> while in insert mode (and the list visible). I am trying to
> issue a <C-Y> from within my function. All attempts so far have failed. My
> latest attempt is this line:
> exec "normal! i\<C-Y>"
>
> As soon as the above line executes Vim crashes.
>
> So Bram, this is 2 things:
> 1. A bug report.
> 2. A question, how can I issue a <C-Y> from within a function executing
> during an imap?
1. I can confirm the crash, slightly simplified:
fun! DIT()
if pumvisible()
execute "normal! i\<C-Y>"
endif
return ""
endfun
imap <c-right> <C-R>=DIT()<CR>
With the completion menu open, I type <C-Right><C-X><C-O> and gvim
crashes. I get the same thing typing <C-R>=DIT()<CR> instead of using
the mapping.
2. I think that what you want is something more along these lines:
fun! DIT2()
if pumvisible()
return "\<C-Y>"
else
return ""
endif
endfun
imap <F4> <C-R>=DIT2()<CR>
HTH --Benji Fisher