Hi David, On 4/25/06, David Fishburn <[EMAIL PROTECTED]> wrote: > > I want to write a conditional imap that will only be active when the OMNI > completion popup window is active. > > I can't quite get this to work. > > I have tried a few combinations of imaps: > imap <buffer> <c-right> > <C-R>=pumvisible()?"\<lt>C-Y>\<lt>C-\>\<lt>C-O>:call > sqlcomplete#Map('column')\<lt>CR>\<lt>C-X>\<lt>C-O>\<lt>CR>":""<CR> > imap <buffer> <c-right> <C-R>=pumvisible()?"\<lt>C-Y><C-\><C-O>:call > sqlcomplete#Map('column')<CR><C-X><C-O>":""<CR> > imap <buffer> <c-right> if pumvisible()|<C-Y><C-\><C-O>:call > sqlcomplete#Map('column')<CR><C-X><C-O>|endif >
You can try the following: function! Sql_Ctrl_Right_Map() if pumvisible() return "\<C-Y>\<C-\>\<C-O>:call sqlcomplete#Map('column')\<CR>\<C-X>\<C-O>" else return "" endif endfunction inoremap <buffer> <expr> <c-right> Sql_Ctrl_Right_Map() - Yegappan > I can't use the if since that starts adding literal characters. > I found a post by Georg Dahn which indicated he was using the \<lt>, not > sure why, but I tried it as well. > > Net result, nothing is working so far, the above either do nothing or result > in unexpected behaviour. > > The imap I use (which works exactly as I want) when the popup is visible is: > imap <buffer> <c-right> <C-Y><C-\><C-O>:call > sqlcomplete#Map('column')<CR><C-X><C-O> > > Thanks in advance for any suggestions. > > Dave >