Friday, July 16, 2010

Trying to improve my code-completion in Python

Hi.
After playing wit different ways of completion in vim coding Python I
found that a mix of several methods seems to be the best option.
I found that using dictionaries is more reliable than omni completion,
because some of the modules I am using don´t laod properly from vim,
you don´t have completion of keywords and is slower.
So I found the Pydiction plugin:
http://www.vim.org/scripts/script.php?script_id=850
Which is nice, but the problem is that when you have an instance of a
class it cannot be found in the dictionary.
For instance:
p = re.compile('[a-z]+')
print (p.match("hola"))
Well, when you type "p" in the print statement you get "no match"
because using Pydiction you set iskeyword to include . and ( with the
next statement:
setlocal iskeyword +=.,(
In the dictionary you have re.match( rather than p.match().
So in this situations is better to go back to the standar complete
looking inthe current and used buffers o look for the word match.
Basically what I want to do is to make a complete using dictionaries
and with iskeyword +=.,(
And if this search don´t get nothing then complete using the usual
<C-N> or <C-P>, but with the standar iskeyword, ,which doesn´t include
. or (
I want to do this with just one keymap.
This way i will get a more reliable completion method, and I dont need
to do first a dictionary search, and then, if needed, a regular
complete.

Is it possible?
Thanks


--
Un saludo
Best Regards
Pablo Giménez

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: