lifepillar / vim-mucomplete

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

mucomplete autocompletes the word on space #93

Closed bbtdev closed 6 years ago

bbtdev commented 6 years ago

Hello,

So if I type Ap, mucomplete to Api and is really annoying anyway I can disabled this behaviour, autocomplete on tab only?

lifepillar commented 6 years ago

I am not sure I follow you. MUcomplete does complete with Tab only by default. Do you have ~g:mucomplete#autocomplete_on_startup~ g:mucomplete#enable_auto_on_startup set to 1, perhaps?

Edit: fix variable name.

bbtdev commented 6 years ago

Can I configure so it does not autoinserts when I press Tab and then space? If I dont find what I'm looking for I don't want random word from the list? completeopt+=noinsert doesn't achieve this?

I like the autopopup, I just want to insert only if I use tab and select from the list

lifepillar commented 6 years ago

If you press Tab, the first menu entry is always automatically selected and inserted regardless of completeopt. I think all editors work like that. I may add an option to respect completeopt even when completion is activated manually, though.

bbtdev commented 6 years ago

What about when it's auto? Anyway I can cancel the auto insertion with space? So it only work when inoremap < space > pumvisible() ? "\" : "\" But this ruins TAB selections. So it only selects an entry from the popup with TAB only? Basically select only on Tab

bbtdev commented 6 years ago

Found the problem, it's autopair https://github.com/jiangmiao/auto-pairs

So many hours lost, wow. Auto-pairs affects space behaviours. No idea if this plugin is popular, I like(d) it.

Switched to Raimondi/delimitMate, no problems.

lifepillar commented 6 years ago

Can I configure so it does not autoinserts when I press Tab and then space? If I dont find what I'm looking for I don't want random word from the list?

I may add an option to respect completeopt even when completion is activated manually, though.

Good Lord, I had forgotten that MUcomplete already has that option! (Too many things running through my head currently.) See the help for g:mucomplete#always_use_completeopt: is that what you are looking for?

Found the problem, it's autopair

I have used auto-pairs briefly and I have not seen any conflict. If you still use it and it does not interact well with µcomplete for you, please open a new issue with details on how to reproduce the issue you encounter.

lifepillar commented 6 years ago

Auto-pairs affects space behaviours. No idea if this plugin is popular, I like(d) it.

I have documented the settings to make auto-pairs work well with µcomplete (and endwise). Please review :help mucomplete-compatibility if you still use auto-pairs.

bbtdev commented 6 years ago

I switched to delimiMate and no issues encountered. Don't have much time to do testing atm, but the mucomplete has been working great. Did not touch vim config for almost a week....the good life.

promisedlandt commented 6 years ago

Fyi, I fixed it with the following:

let g:AutoPairsMapSpace = 0
imap <silent> <expr> <space> pumvisible()
      \ ? "<space>"
      \ : "<C-R>=AutoPairsSpace()<CR>"

Not sure about any unintended side effects yet, but works for me now.

@lifepillar If it works for you too, feel free to include it in the docs, no attribution needed.

lifepillar commented 6 years ago

@promisedlandt Would you mind providing an example showing the issue that your snippet solves?

promisedlandt commented 6 years ago

Sure. It's a bit awkward since it doesn't happen without tag completion.

I have provided a simple example here, but you will need to adapt the paths in the tags file: https://gist.github.com/promisedlandt/98673e1fb31df92d9d7d643e901b7a93

Needs AutoPairs + mucomplete. The stuff from the vimrc is the part of my mucomplete config that is enough to reproduce the error.

lifepillar commented 6 years ago

Thanks, I can reproduce it.

lifepillar commented 6 years ago

@promisedlandt Thanks for the snippet, I have included it in the documentation!