vim-mucomplete icon indicating copy to clipboard operation
vim-mucomplete copied to clipboard

Clarify g:mucomplete#minimum_prefix_length

Open andreypopp opened this issue 6 years ago • 6 comments
trafficstars

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).

andreypopp avatar May 17 '19 08:05 andreypopp

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

lifepillar avatar May 17 '19 11:05 lifepillar

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

BrokenHugh avatar May 30 '19 13:05 BrokenHugh

@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.

mg979 avatar May 30 '19 14:05 mg979

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.

BrokenHugh avatar May 30 '19 15:05 BrokenHugh

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

mg979 avatar May 30 '19 15:05 mg979

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?

lifepillar avatar Jun 02 '19 18:06 lifepillar