Can Omnicomplete in Vim for python / 3 have full function names or just methods?

To illustrate my question, here is a simple example of how Omnicomplete operates on my machine:

name = "Bob" na<Cx><Co> gives-----> name name.<Cx><Co> gives-----> (correct dropdown menu of methods for string) prin<Cx><Co> gives-----> (-- Omni completion (^O^N^P) Pattern not found) 

I expected the last line to expand to print or print( or something like that. Is this the correct behavior (Omnicomplete only completes the method for python / 3)? If so, would the execution of the function in the latter case be an example above which fragments for?

I am using MacVim in terminal with tmux. My :version says VIM 8.0. I have +python/dyn and +python3/dyn functions. My ~/.vimrc has this line (among other things):

 autocmd FileType python set omnifunc=python3complete#Complete 

Right now, I'm only editing python3 files, so I think omnifunc=python3... is fine.

SO post semi-join: Vim omnicomplete and system Python issue

EDIT: I might have a workaround, although I don't know how to implement it.

Notice, that:

  import builtins builtins.pr<Cx><Co> gives-----> (dropdown menu with print() and property() ) builtins.pri<Cx><Co> gives-----> (autocompletes to builtins.print( ) 

Is it possible to replicate this action using <Cx><Co> without writing import builtins and using the builtins object? Perhaps a search for <Cx><Co> suggests builtins. if the line preceding <Cx><Co> does not have . in her?

I have all the ears for any suggestions.

+5
source share

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


All Articles