> I give up. The procedure you came up with works for other keys but not > for <C-N> (and possibly <C-P> as well). The function doesn't even get > called when completion popup is visible. Even for other keys where the > function gets called, I made several attempts to do what I want and none > worked properly. What I want is to remap <Down> to <C-N> (which is no > problem) but to also move the cursor to the end of the line before doing > <C-N>. I had two mixed results. In the first result, I am able to move > the cursor to the end, but <C-N> will then be treated as a trigger for > fresh insert mode completion (and I am not using a 'completefunc' to set > matches, so my completions get overwritten by what Vim generates by > default). In the second result, <C-N> works, but the cursor is not moved > to the end of the line. I tried to use all kinds of tricks mixing > the use of feedkeys(), inputsave/restore() and others. Something is very > fishy about <C-N>, when it is anywhere in the map (LHS or RHS), > everything else gets ignored.
There is a high probability that I am being dense, but it actually seems to work for me now. Here is what I'm doing. :imap <C-N> <C-R>=Wibble()<CR> function! Wibble() if pumvisible() return "visible" else return "unvisible" endif endf I type the beginning of a tag ("actor_") and press <C-P> to open up the popup menu. Vim enters the first match ("actor_get"), and I then press <C-N>, and it changes the string to "actor_getvisible". In normal insert mode pressing <C-N> just enters "unvisible". Either I am misunderstanding the problem, or maybe I'm just special? Let me know if you need any more details of my setup. Max