On 22/10/2016 13:57, Lifepillar wrote:
> On 22/10/2016 11:14, Lifepillar wrote:
>> Hello,
>> I have a problem with a plugin I am writing. To reproduce [snip]
>
> Ok, I think that my example may be reduced to the following:
>
> fun! G()
> return "\<c-c>k"
> endf
>
> fun! F()
> return "\<c-r>=G()\<cr>"
> endf
>
> imap <expr> <tab> F()
>
> Is there a way to have this working (i.e., have <c-c> remapped to what
> the SQL filetype defines)?
Took me a while to figure out, but solved my problem. For the record:
fun! G()
return "\<c-c>k"
endf
fun! F()
return "\<c-c>s\<plug>(Foo)"
endf
imap <expr> <tab> F()
imap <expr> <plug>(Foo) pumvisible() ? '' : G()
Now, pressing <tab> will trigger <c-c>s and, if no results are found,
<c-c>k, and both mappings will be remapped, as I wanted.
Life.
--
--
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.
Sunday, October 23, 2016
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment