Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify g:mucomplete#minimum_prefix_length #148

Open
andreypopp opened this issue May 17, 2019 · 6 comments
Open

Clarify g:mucomplete#minimum_prefix_length #148

andreypopp opened this issue May 17, 2019 · 6 comments

Comments

@andreypopp
Copy link

The doc states

The minimum number of (keyword) characters that must be present before the
cursor for automatic completion to be triggered.

But I found out that I need this to set to 0 so it works with manual Tab completion after an id with dot (ex. Result.|) when I use ALE's omnifunc. Otherwise Tab doesn't trigger the completion menu (note that I can trigger completion with C-x C-o just fine).

@lifepillar
Copy link
Owner

Is . in iskeyword? Usually, it is not considered a keyword character.

@BrokenHugh
Copy link

Hi, I just meet similar problem, I use tern_for_vim(javascript completion),the popup menu doesn't show up automatically when I press dot key(have to C-x C-o) manual).
And I couldn't find iskeyword in help document ,actually i dont know how to add . in iskeyword

@mg979
Copy link
Contributor

mg979 commented May 30, 2019

@BrokenHugh maybe you could try

augroup insert_dot
  au!
  au InsertEnter * set iskeyword+=.
  au InsertLeave * set iskeyword-=.
augroup END

You can limit it to filetypes by changing * with *.js or else.

@BrokenHugh
Copy link

BrokenHugh commented May 30, 2019

Thank you for your help. It works for me after set iskeyword+=.
But I found the other completion plugin jedi-vim doesn't need to do this by default or let g:jedi#popup_on_dot = 0 when I try to figure it out.
still weird.

@mg979
Copy link
Contributor

mg979 commented May 30, 2019

jedi-vim actually remaps . in insert mode, to do its own stuff. It's a plugin-defined behaviour, vim doesn't do it on its own.

If it worked after pressing . and then <c-x><c-o>, maybe you can get the same by replacing the autogroup above with:

augroup insert_dot
  au!
  au FileType javascript inoremap <buffer> .   .<c-x><c-o>
augroup END

@lifepillar
Copy link
Owner

In autocompletion mode, MUcomplete by default triggers completion when there are at least two keyword characters in front of the cursor, where “keyword” is defined by the iskeyword options (see :help 'iskeyword'). Usually, . is not in iskeyword (but it may be added, as suggested above).

You may use g:mucomplete#can_complete to change MUcomplete's default behaviours, globally or for a specific filetype.

I have been asked in the past to enable completion after a dot in C/C++ and Python, so for such languages completion is already triggered after a dot. Which filetype(s) are you working on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants