Sunday, May 8, 2016

Re: Make auto-completion insert multi-line text at one selection

Hi

----- Mail original -----
> It seems the auto-completion feature does not allow multi-line text
> to be inserted at this point:
> [...]

> Can someone familiar with the implementation of Vim tell whether the
> custom-completion feature can be enhanced to become a general UI
> feature for user selection? The most useful IMHO would be:
>
> *. Allow normal mode invocation
>
> *. Pass the selection as a return value, instead of inserting it to
> the current buffer

I provide a function in lh-vim-lib (1) that permits to define advanced completions. I use it in mu-template (2). The idea is to register a callback that is executed when the completion is validated -- as it's a callback, nothing is necessarily expanded. It's up to the callback function to decide what must be done.

Normal mode completion is not that complex. You just need to play with :normal, and possibly with :exe ":normal ...".

(1) lh#icomplete#new() and lh#icomplete#new_on()
https://github.com/LucHermitte/lh-vim-lib

(2) https://github.com/LucHermitte/mu-template

HTH,

--
Luc Hermitte

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment