lifepillar / vim-mucomplete

Chained completion that works the way you want!
MIT License
911 stars 18 forks source link

How to add the line completion <C-X>L to the results? #182

Closed psprint closed 4 years ago

psprint commented 4 years ago

Hi, I've tried:

let g:mucomplete#user_mappings = { 'keyl' : "\<c-x>l" }
let g:mucomplete#chains = { 'zsh' : ['file', 'keyn', 'keyl'] }

However this breaks input – after entering a key it starts repeating ls, like so:

    return <a key is entered now>0llllllllllllllllllllll
lifepillar commented 4 years ago

Line completion is supported out of the box with the "line" method:

:let b:mucomplete_chain = ['line']

Type:

I like biking
I like swimming
I like<Tab>
psprint commented 4 years ago

It behaves differently than <C-X><C-L>, see asciicast.

lifepillar commented 4 years ago

You are not supposed to use g:mucomplete#user_mappings to (re)define built-in completion methods. That's not going to work as expected, in general. MUcomplete provides all of them, in a way that takes into account the particular way each one works. So, stick with 'line' and 'omni', for line-completion and omni-completion, respectively.

In your example, the second configuration (using 'line') works as expected: since 'keyn' is before 'line', you get keyword completions first. The first configuration (using your own 'keyl') does not produce the expected result (and it's not expected to do so as you are mapping a built-in method), because keyword completion should be triggered, not line completion.

If you want line completion to be given a higher priority, put it earlier in the chain, e.g., try:

:let b:mucomplete_chain= ['file', 'line', 'keyn']

As for the lag, you should check your omni-completion function and/or tags completion (which seem the ones that cause a delay in your example). For instance, to test omni-completion, disable MUcomplete auto-completion (:MUcompleteAutoOff), then try completing by typing CTRL-X CTRL-O. For tags, try CTRL-X CTRL-]. Are those as slow?

psprint commented 4 years ago

Ok, it now works. However, omni has a strange side effect: asciicast.

psprint commented 4 years ago

One other problem: asciicast.