Ending introspective code with VIM? ... or another lightweight editor with this feature?

I was all over the Internet trying to find a way to get VIM to complete code like PyDev. It doesn't seem like it's possible!

- I tried to use the omnicompletion suggested here: http://blog.dispatched.ch/2009/05/24/vim-as-python-ide/ .

-I tried several add-ons to alleviate the problem, no one works.

The "omnicomplete" functionality is NOT what I'm looking for. It just takes all the words in the file you're working on, and uses it to try and complete what I'm doing. For example, if I wrote:

import numpy a_single_array = range(100) np.a#[then I hit cntrl+n to code complete] 

He would spit out "a_single_array" as a possible conclusion, but this is absurd! This is not a valid termination for "numpy.a ..."

What is the problem? All add-ons must do is launch dir (the job you want to find) from the folder you are in, and then filter the output! It can't be that hard! (I suppose you will also need to read the file you are currently editing and filter it to also note the name changes ... but this is pretty much!)

Speaking of how easy it would be ... if nothing was done, I was thinking of writing the script itself! Any guides on how to do this?

+7
source share
3 answers

No, the omni completion function is EXACTLY what you are looking for.

You use <Cn> instead of <Cx><Co> :

  • enter <Cn> and <Cp> to fill in the words from the buffer (after and before the cursor, respectively)
  • type <Cx><Co> to complete the method / property name

This is explained in the article you pointed out:

VIM introduced omni termination in V7 - given that it is configured for Python recognition (if not, this function is just a plugin) Ctrl + x Ctrl + o opens a popup dialog like any other IDE - even the whole Pydoc will be displayed in a split the window.

+7
source

Ctrl n is insertion completion.

Ctrl x Ctrl o is an omni termination.

I reassign omnicompletion to Ctrl Space :

 inoremap <C-Space> <Cx><Co> 

You can also try SuperTab .

+4
source

I have no idea about the various completion options for Python in Vim. But if you want to collapse yourself, it will be useful for you to study and change one of the existing ones, for example:

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

Also, if all your omnicompletion does is enumerate the words in the current file, then you won’t configure it correctly to terminate Python. I'm not sure how good specialized Python termination systems are, but they certainly compete based on Python blocks external in relation to your current file. ,,

+1
source

All Articles