Search code examples
pythonvimautocompletejedi-vim

Jedi-vim automatically insert only matching option (need to disable it)


Problem is when jedi-vim finds only one match for autocomplete it automatically insert this match. I need somehow disable this feature.

What I've already tried:

  • let g:jedi#smart_auto_mappings = 0, but it only disables auto from ... import ... insertion;
  • let g:jedi#popup_on_dot = 0, but it also disable popup on dot options (so I need to type <C-space> to see it).
  • let g:jedi#popup_select_first = 0 also won't help as it only disable first match selection in popup menu, but not prevent auto insertion of only match.

Also I don't have any other autocomplete plugins installed. If it helps, this is my .vimrc file

Is there some way to disable auto insert of only matching feature but keep popup on dot?

P.S. you can recreate this behavior with this example:

class A(InvisibleClass):
    i = 1

Then when you type A and press dot i will be inserted automatically.


Solution

  • This behavior is controlled by Vim's completeopt option. jedi-vim sets it to menuone,longest,preview since you haven't changed it (starting here). You should explicitly set it in your .vimrc to include noinsert.

    Vim's docs say that noinsert has no effect if longest is present, but that doesn't match the behavior I'm actually seeing (NVIM 0.0.0-alpha+201510011522 (compiled Oct 5 2015 14:55:04)).