1
filetype plugin on
autocmd FileType python set omnifunc=pythoncomplete#Complete 

I found that pythoncomplete can't complete python's build-in functions.

vim  test.py
import os
os. #Now the complete menu pop up.

enter image description here

When i want to auto complete python's build-in function such as frozenset, input frozen and input <C-X><C-O> ,an error occurs.

enter image description here

1

If you are referring to the following plugin: https://github.com/mjbrownie/pythoncomplete.vim or

https://www.vim.org/scripts/script.php?script_id=1542

you will notice that they haven't been updated since 2014 or 2009 respectively. Obviously vim has come a long way, and if these plugins are not updated and depending on which version of vim you are using, these will have problems. Instead of trying to figure out whats going on, and so that you can keep using the plugin, I suggest you change your plugins.

The latest autocomplete plugin that is gainin a lot of traction is :

https://github.com/palantir/python-language-server

in conjunction with

https://github.com/autozimu/LanguageClient-neovim.

If you are vim8 or neovim, these will work much better. The LSP plugin is also used in VSCode, so its used very widely and shouldn't have too many bugs. On the other hand pythoncomplete is not very well used, and is likely to have more bugs.

If you are on older versions of vim, you can use

https://github.com/davidhalter/jedi-vim

Which should be compatible with all version of vim

  • How to make python-language-server complete frozen as frozenset? – it_is_a_literature Apr 1 '18 at 8:39
  • This is part of autocompletion framework. The problem as I explained above is not about autocompletion itself but that you are using a very old completion engine. The latest versions of autocompletion frameworks shouldnt have problems in completing built in libraries. Even YouCompleteMe which is a older generation of completion libraries can do this relatively easily and accurately. – alpha_989 Apr 1 '18 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.