> -----Original Message----- > From: Hari Krishna Dara [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 15, 2006 8:23 PM > To: vim@vim.org > Subject: Inability to map <C-N> when completion popup is visible > > > I am trying to map <C-N> and <C-P> to behave differently when > pumvisible() returns true, but Vim seems to completely ignore this. > E.g., if I create this unconditional map (a much simpler one > than what I > wanted): > > inoremap <C-N> <C-C> > > pressing ^N normally stops insertmode, but when popup is > visible, Vim never executes the map. This may be true for > <C-P> also, but the same is not true for, say <Up>. > > inoremap <Up> <C-C> > > Using the above map, pressing <Up> arrow always stops insert > mode, whether popup is visible or not. Is this a bug? I > tested by starting with -u NONE option to avoid any other > interferences.
I had a lot of problems trying to get this to work as well. In the end I was unable to map it without making a function call. autoload/sqlcomplete.vim does the following: if has('win32') imap <buffer> <c-right> <C-R>=sqlcomplete#DrillIntoTable()<CR> imap <buffer> <c-left> <C-R>=sqlcomplete#DrillOutOfColumns()<CR> endif function! sqlcomplete#DrillIntoTable() " If the omni popup window is visible if pumvisible() call sqlcomplete#Map('column') " C-Y, makes the currently highlighted entry active " and trigger the omni popup to be redisplayed call feedkeys("\<C-Y>\<C-X>\<C-O>") else if has('win32') " If the popup is not visible, simple perform the normal " <C-Right> behaviour exec "normal! \<C-Right>" endif endif return "" endfunction In this case, if the popup window is not visible I want to perform the standard <C-Right> so the user does not loose any functionality due to the mapping. For the lurkers, this is for Vim7 since pumvisible() and feedkeys() are Vim7 functions. HTH, Dave