You are not logged in.
More info here: http://phraktured.net/blog/2006/01/04/vim-python/
For those of you who don't know what omni completion is, it's a vim-devel thing (in [unstable]) that looks like this:
See the popup there listing arg, node, string, and type?
Here's it in python (with a slightly more-fugly popup color):
Offline
Oh man, that's well sweeeeet!
Offline
I just uploaded v0.2 of the omnifunc - now it should work for everything except local variables inside classes and "self.X" variables set inside classes. The local class parsing is the most complicated chunk, so that will take some time to muck with.
Test it out, let me know what's going on.
PS omnifuncs are still missing for most languages
C requires a ctags patch
C++ requires icomplete
html/css are provided in the distribution
Now here's python.
Ruby should be just as easy, and I may look into that as well, assuming ruby can lex itself.... can it?
Offline
woooooooooow.... real code completion in vim? Like honest to god..... and it works python.....ooooooooooooooohk, I'm tempted to try vim again. wow!
Dusty
Offline
woooooooooow.... real code completion in vim? Like honest to god..... and it works python.....ooooooooooooooohk, I'm tempted to try vim again. wow!
Heh, it "works" in python... as I said, there's still some errors to iron out - such as being unable to complete local variables inside class definitions because I trash function bodies... and a few other things. At some point, I'd like to add signature completion too, but that would require inspect, and doesn't work on builtins, I don't think.
For the record, it's C-x,C-o (C-x is the universal "completion" prefix... C-x,C-f completes file names, etc etc) - C-o is for "omni".
Right now this is pretty functional - but feel free to bug report whatever you want.
Offline
Man, what would vim users around the globe do without you phrak? Seriously, that's awesome engineering
.oO Komodo Dave Oo.
Offline
If anyone has tried this, please let me know what is lacking and what you'd like to see.
On a side note, I'm looking for a way to get the signature of a python function like so:
foo = sys.exc_info
function_sig(foo)
#prints "()"
Offline
Oooh, that's nice.
btw, what colorscheme are you using for the top one? It's purdy...
Offline
The top scheme is just 'desert', but the terminal colors come from rezza (see the Desktop forum, for the terminal colorscheme thread I started)
Offline
w00tlicious. I'm going to give you a pizza.
Offline
Updates galore! Now it's secure and completes arguments - give it a whirl if ya want.
Offline
Phrakture is very wise.
Offline
Please, if you have a chance, try this and bug report the crap out of it.
Testing steps:
Install vim-devel from [unstable]
Download pycomplete.vim - either put it in ~/.vim/autoload, or /usr/share/vim/autoload.
Upon opening a python file, type :set ofu=pycomplete#Complete
[ Optionally, something like "au BufRead,BufNewFile *.py set ofu=pycomplete#Complete" in ~/.vimrc would work ]
Also, you can change popup colors like so:
hi Pmenu ctermfg=0 ctermbg=7
hi PmenuSel ctermfg=7 ctermbg=4
hi PmenuSbar ctermfg=0 ctermbg=4
hi PmenuThumb gui=reverse
Then just use C-x,C-o for the popup menu. Let me know if you get any errors or just funky workings. I'd like to iron most of this out soon, so I can start adding __doc__ previews.
Offline
If anyone has tried this, please let me know what is lacking and what you'd like to see.
On a side note, I'm looking for a way to get the signature of a python function like so:
foo = sys.exc_info function_sig(foo) #prints "()"
Did you ever get this? I just saw the post... I believe you can use the "co_argcount" and "co_varnames" members of a code object to do it. i.e. the first co_argcount elements of co_varnames.
Looks like a rather nice tool. Too bad I don't do more Python programming.
Offline
Did you ever get this? I just saw the post... I believe you can use the "co_argcount" and "co_varnames" members of a code object to do it. i.e. the first co_argcount elements of co_varnames.
Looks like a rather nice tool. Too bad I don't do more Python programming.
Yup, I ganked the code from IDLE's calltips section. Odd part is that co_varnames and company don't work on C based python modules (i.e. half the standard library), however most of those contain the signature in the doc string, so I parse that as well
Offline
So if pressing Ctrl-x Ctrl-o does omni completion... what is Ctrl-n doing? It pops up a window as well...
Offline
So if pressing Ctrl-x Ctrl-o does omni completion... what is Ctrl-n doing? It pops up a window as well...
Ctrl-n and Ctrl-p are not completion mechanisms in and of themselves. They simply repeat the last completion type given. For instance, if you do "/usr/bi<C-x,C-f>" and then use <C-p> you will get file completion again.
Also, the popup menu is not unique to omni-completion, it can be used for everything:
*'completeopt'* *'cot'*
'completeopt' 'cot' string (default: "menu")
global
{not in Vi}
Options for Insert mode completion |ins-completion|.
Currently the only supported value is:
menu Use a popup menu to show the possible completions. The
menu is only shown when there is more than one match and
sufficient colors are available. |ins-completion-menu|
Offline
Is that a console terminal, xterm, etc? I mean there is no need for gvim?
Popup completion works in both console and gui modes.
Offline