Python omnicompletion in vim not working

I am trying to use vim in my python journey based on this guide

I think I have the same problem as the paid nerd , but since he did not find the solution I am posting here again.

For some reason, I cannot get omnicompletion to work in vim using python. I installed the fabolous R-plugin and created a list of tags. So I get omnicompletion with R.

But not for python. A few observations:

  • :echo &omnifunc prints pythoncomplete#Complete .
  • There are R tags in the .vim/doc/tags file but no python (but is that because python is supported by default correctly?)
  • If I do import math in my .py file, I can autofill for example. ma to math. but no methods found?

So - in conclusion, I was really confused: - / - and if someone can help ...

+4
source share
5 answers

It looks like the default omnicompletion for python ( pythoncomplete#Complete ) does not know about buildins / keywords.

When you Ctrl-X Ctrl-O on math. (if you imported β€œmath”), you should see the available math. functions math. but do it for print , sorted etc. I think you need a plugin:

+6
source

I assume that all the modules you import are in the Python path, right? Check if all your import works in this file, in my case one unsuccessful import (syntax error in the imported module) violated omnicompletion.

0
source

check ~ / .vim, inside the doc directory you should have NERD_tree.txt, so you should have the nerd tree., plugin installed.

0
source

.vim/doc/tags contains Vim documentation tags (including the R plugin), and this has nothing to do with the tags that are used to complete it. You can regenerate them with

 :helptags ~/.vim/doc 

When it comes to completion, what key combination do you use? By default, omni-complete is bound to Ctrl-X Ctrl-O , and not to regular Ctrl-N .

0
source

There are a number of plugins to complete python. Vim python filetype plugin seems to be the best at the moment. This requires a vim built with python support, and otherwise it will work out of the box. Completing system modules will work, and you will use their methods in omnicompletion.

0
source

Source: https://habr.com/ru/post/1345434/


All Articles