# (debian,vim,Qt,ruby) on vim : no completion but everything else works fine

**URL:** <https://www.ruby-forum.com/t/debian-vim-qt-ruby-on-vim-no-completion-but-everything-else-works-fine/169091>\
**Category:** Ruby\
**Created:** [May 29, 2009, 9:25am UTC](https://www.ruby-forum.com/t/debian-vim-qt-ruby-on-vim-no-completion-but-everything-else-works-fine/169091 "2009-05-29T09:25:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jolivierld](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/34f0e0/32.png) [@jolivierld](https://www.ruby-forum.com/u/jolivierld)\
**Post date:** [May 29, 2009, 9:25am UTC](https://www.ruby-forum.com/t/debian-vim-qt-ruby-on-vim-no-completion-but-everything-else-works-fine/169091/1 "2009-05-29T09:25:53Z")

</div>

Hello,

I have a little/big problem with vim and ruby.  
little because almost all works fine : on debian I installed  
vim,vim-ruby,ruby1.8,qt4-qtruby, and Qt.  
on vim I have the syntax coloring that’s working, and a program like  
"print  
require ‘Qt4’ " returns true : Qt4 is recognized.

but I have not the completion for Qt : if I enter "a=Qt:: " +CTRL X+CTRL  
O,  
I have the messsage “pattern not found” .

on vim I have:  
:set ofu? =\> omnifunc=rubycomplete#Complete  
:set ft? =\> filetype=ruby  
:filetype =\> all 3 are ON

can you help me to have the completion?  
or maybe I have made a mistake, an oversight.

thx,

olivier.

* * *

Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son  
interface révolutionnaire.

> **[Yahoo](https://mail.yahoo.com/)**
>
> It's

---

<div class="post-metadata">

**Author:** ![jolivierld](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/34f0e0/32.png) [@jolivierld](https://www.ruby-forum.com/u/jolivierld)\
**Post date:** [May 29, 2009, 2:30pm UTC](https://www.ruby-forum.com/t/debian-vim-qt-ruby-on-vim-no-completion-but-everything-else-works-fine/169091/2 "2009-05-29T14:30:50Z")

</div>

On May 29, 8:22 am, lolveley [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> on vim I have:  
> :set ofu? =\> omnifunc=rubycomplete#Complete  
> :set ft? =\> filetype=ruby  
> :filetype =\> all 3 are ON
> 
> can you help me to have the completion?  
> or maybe I have made a mistake, an oversight.  
> Code completion with QtRuby will only work if you are interacting with  
> running code with a tool such as irb. It won’t work with static  
> environments like vim. So I would run irb as well as vim to try things  
> out, and also use the command line ‘rbqtapi’ tool to introspect the  
> QtRuby api.

– Richard

---

<div class="post-metadata">

**Author:** ![jolivierld](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/34f0e0/32.png) [@jolivierld](https://www.ruby-forum.com/u/jolivierld)\
**Post date:** [May 29, 2009, 6:07pm UTC](https://www.ruby-forum.com/t/debian-vim-qt-ruby-on-vim-no-completion-but-everything-else-works-fine/169091/3 "2009-05-29T18:07:57Z")

</div>

removed\_email\_address@domain.invalid a écrit :

> > but I have not the completion for Qt : if I enter "a=Qt:: " +CTRL X+CTRL O,  
> > Code completion with QtRuby will only work if you are interacting with  
> > running code with a tool such as irb. It won’t work with static  
> > environments like vim. So I would run irb as well as vim to try things  
> > out, and also use the command line ‘rbqtapi’ tool to introspect the  
> > QtRuby api.
> 
> – Richard

well, it’s amazing : I have succeeded in having the completion of Qt  
classes and methods by typing : let g:rubycomplete\_buffer\_loading=1.

olivier.

* * *

Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son  
interface révolutionnaire.

> **[Yahoo Mail](https://mail.yahoo.com/)**
>
> Take a trip into an upgraded, more organized inbox. Sign in and start exploring all the free, organizational tools for your email. Check out new themes, send GIFs, find every photo you've ever sent or received, and search your account faster than...

---

<div class="post-metadata">

**Author:** ![jolivierld](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/34f0e0/32.png) [@jolivierld](https://www.ruby-forum.com/u/jolivierld)\
**Post date:** [May 29, 2009, 6:36pm UTC](https://www.ruby-forum.com/t/debian-vim-qt-ruby-on-vim-no-completion-but-everything-else-works-fine/169091/4 "2009-05-29T18:36:45Z")

</div>

On May 29, 5:03 pm, lolveley [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > require ‘Qt4’ " returns true : Qt4 is recognized.  
> > > or maybe I have made a mistake, an oversight.  
> > > classes and methods by typing : let g:rubycomplete\_buffer\_loading=1.  
> > > Oh, that’s intesting. I was assuming that vim code completion worked  
> > > by statically analyzing the ruby sources. But if it works with QtRuby  
> > > it must mean it is running code and doing introspection. Nearly all  
> > > method calls in QtRuby are trapped by method\_missing() and then  
> > > forwarded as C++ invocations. So that means that the Ruby methods  
> > > don’t really exist as such, they are not defined with rb\_define\_method  
> > > () or as Ruby code.

irb(main):002:0\> Qt::Widget.instance\_methods.sort  
=\> [“==”, “===”, “=~”, “QT\_TRANSLATE\_NOOP”, “QT\_TR\_NOOP”, “SIGNAL”,  
“SLOT”, “ **id** ”, “ **send** ”, “acceptDrops”, “acceptDrops=”,  
“accessibleDescription”, “accessibleDescription=”,“accessibleName”,  
“accessibleName=”, “actions”, “activateWindow”, “activeWindow?”,  
“addAction”, “addActions”, “adjustSize”, “attribute=”,  
“autoFillBackground”, “autoFillBackground=”, “backgroundRole”,  
“backgroundRole=”, “baseSize”, “baseSize=”, “blockSignals”, “childAt”,  
“children”, “childrenRect”, “childrenRegion”, “class”, “className”,  
“class\_name”, "clear  
…

So vim must be making Ruby method calls like the above to know about  
QtRuby methods (instance\_methods() queries the ‘Smoke’ library runtime  
to find the names of the Qt C++ methods).

– Richard
