Thanks Tony and Ingo, <C-O> was the thing I didn't know.

<Plug>IsymchooseComplete is inoremap'ed to <SID>Complete, which
in turn inoremap's to <C-O>:call <SID>Complete()<CR>

I think this is the correct namespace-pollution-free solution, and
the any errors that <SID>Complete() coughs up stay visible now.

If it wasn't possible to write <SID>Complete() as the last element of
the innermost map, I guess one would have to export a function, but
happily that wasn't necessary, at least in my case.

Britton 

On Sun, 22 Mar 2009 21:27 +0100, "Ingo Karkat" <[email protected]>
wrote:
> 
> On 22-Mar-09 20:40, Tony Mechelynck wrote:
> > On 22/03/09 19:02, Britton Kerin wrote:
> >>
> >> I wrote a plugin, and following the description of how to do
> >> key bindings I ended up with
> >>
> >>      <Plug>IsymchooseComplete
> >>
> >> available.  I'd like to advise users what to put in their .vimrc
> >> in order to enable completion from insert mode.  This works:
> >>
> >>      imap<S-Tab>  <Plug>IsymchooseComplete<Esc>:call feedkeys("a",
> >>      "n")<CR>
> >>
> >> the trouble is when Isymchoose fails somehow, the message only flashes
> >> for an instant and is then removed by the fed keys which I use to drop
> >> back into insert mode.  I'd like to avoid this.
> >>
> >> I'd like to use just
> >>
> >>      imap<S-Tab>  <Plug>IsymchooseComplete
> >>
> >> but this seems to end insert mode.
> >>
> >> Any help or advice greatly appreciated.
> >>
> >> Britton
> > If Vim fleetingly displays an error message, but too fast for you to 
> > readit, you can usually get it back by
> >     :messages
> 
> Tony, Britton didn't ask for a user workaround, but for how to prevent
> the 
> problem as a script writer?!
> 
> Britton,
> It's hard to help without knowing what's behind your
> <Plug>IsymchooseComplete 
> mapping. Usually, insert-mode mappings begin with <C-O> to :call a custom 
> function and immediately go back to insert mode:
>      CTRL-O          execute one command, return to Insert mode  
>      *i_CTRL-O*
> as in e.g.:
>      inoremap <Plug>IsymchooseComplete <C-o>:set 
> completefunc=<SID>IsymchooseComplete<CR><C-x><C-u>
> This should work for you, too, so you don't need to use feedkeys(). If
> your 
> mapping implements a custom completion, also see :help complete-functions
> for 
> more information on how to implement them.
> 
> -- regards, ingo
> 
> -- 
> It's not that I'm afraid to die.  I just don't want to be there when it
> happens.
>                                                                   --
>                                                                   Woody
>                                                                   Allen
> 
> 
> > 



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui