On Fri, 16 Jun 2006 at 11:25am, Max Dyckhoff wrote:

> > 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
>
>

Strange... this works for me as well when I am not in my plugin window,
but when the cursor is in the plugin window, it gets completely ignored
(the breakpoint doesn't even get called, no buffer mapping for <C-N> to
hide this, I checked). This beats me, but I think this is because of the
way I am setting completion items. Instead of using the traditional
'completefunc' or 'omnifunc' approach (which involves invoking a
keysequence), I am using the CursorMovedI event to set completions as
soon as user types something (this is because, the whole purpose of the
plugin is to show matches, so there is no point asking the user to press
<C-X><C-U> or any other key). Looks like I need to look deeper into the
problem. Thanks to all.

-- 
Hari

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

Reply via email to