Vim 7 ruby omni-complete v0.2

Thanks to some outside suggestions and contributions we now have another
release.
If you missed the original announcement, rbcomplete provides a vim7
omni-completion function (code completion) for vim. It is
based on complete.rb, pycomplete.vim and ccomplete.vim.

Whats New:

At the request of many people, Object’s instance methods are no longer
included in the completion list, if anyone wants this functionality
back I’ll make it a configurable.
A major contribution provided rbcomplete.vim with better variable
identification so the following will properly be completed:
a = Time.now
b = [0…2]
c = [‘a’,‘b’]
d = {:a=>‘test’,:b=>‘this’}

sorry, no “e = c” yet. You can find the file at
http://blog.hasno.info/blog/segfault/dev/2006/04/10/vim-7-ruby-omni-completion.html
–mark

Hi!

At Wed, 12 Apr 2006 13:00:06 +0900, Mark G. wrote:

http://blog.hasno.info/blog/segfault/dev/2006/04/10/vim-7-ruby-omni-completion.html

500 Internal Server Error for me :expressionless:

Josef ‘Jupp’ Schugt

Well, once I stripped all the carraige returns from the .vim file, it
kinda worked. When I did ctrl+x ctrl+o it opened a list of classes, but
it always replaced whatever was under the cursor with TrueClass and
that’s all I could get it to do… Am I missing something?

Andrew

Seems to be working currently. Could be that my old box doesn’t agree w/
the increased traffic.
–mark

On 4/11/06, Mark G. [email protected] wrote:

Thanks to some outside suggestions and contributions we now have another
release.
If you missed the original announcement, rbcomplete provides a vim7
omni-completion function (code completion) for vim. It is
based on complete.rb, pycomplete.vim and ccomplete.vim.

Where are we supposed to put the rbcomplete.vim file?

Mark V. wrote:

Where are we supposed to put the rbcomplete.vim file?

I put mine in ~/.vim/autoload and it seems to load OK.

Andrew

On Thu, 13 Apr 2006, Andrew T. wrote:

Mark V. wrote:

Where are we supposed to put the rbcomplete.vim file?

I put mine in ~/.vim/autoload and it seems to load OK.

i get an error about no ‘omnifunc’ attribute. which vim are you
running?

-a

sender: “[email protected]” date: “Thu, Apr 13, 2006 at 06:20:10AM +0900” <<<EOQ
On Thu, 13 Apr 2006, Andrew T. wrote:

Mark V. wrote:

Where are we supposed to put the rbcomplete.vim file?

I put mine in ~/.vim/autoload and it seems to load OK.

i get an error about no ‘omnifunc’ attribute. which vim are you running?
Omnifunc was introduced in version 7:
Though it’s still beta, alfa has been stable for a long time already :slight_smile:

Good luck,
Alex

On 4/12/06, [email protected] [email protected] wrote:

On Thu, 13 Apr 2006, Andrew T. wrote:

Mark V. wrote:

Where are we supposed to put the rbcomplete.vim file?

I put mine in ~/.vim/autoload and it seems to load OK.

i get an error about no ‘omnifunc’ attribute. which vim are you running?

It’s working for me now. Here’s what I did to get it to work under
Windows.

On Thu, 13 Apr 2006, Alexandru E. Ungur wrote:

Though it’s still beta, alfa has been stable for a long time already :slight_smile:

Good luck,
Alex

time to upgrade then… :wink:

-a

Thanks to some outside suggestions and contributions we now have
another
release.
If you missed the original announcement, rbcomplete provides a vim7
omni-completion function (code completion) for vim. It is
based on complete.rb, pycomplete.vim and ccomplete.vim.

Very cool. I just grabbed gentoo’s vim 7.0b, and there were a couple
of issues. Vim doesn’t like the windows endlines at all, and claims
the whole script is garbage. dos2unix fixes that nicely :slight_smile: The other
(really strange) thing is that you use some sort of heredoc with the
tag RUBYEOF. Gentoo’s vim7.0b doesn’t like that at all; it doesn’t
recognize the final RUBYEOF as the end of the string. Changing that to
EOF fixed things. Anyhow, not sure it that’s worth making changes for,
but it’s what I had to do.

Very cool. I just grabbed gentoo’s vim 7.0b, and there were a couple
of issues. Vim doesn’t like the windows endlines at all, and claims
the whole script is garbage. dos2unix fixes that nicely :slight_smile: The other
(really strange) thing is that you use some sort of heredoc with the
tag RUBYEOF. Gentoo’s vim7.0b doesn’t like that at all; it doesn’t
recognize the final RUBYEOF as the end of the string. Changing that
to EOF fixed things. Anyhow, not sure it that’s worth making changes
for, but it’s what I had to do.

yup, forgot to mention the endlines in my other post. flip -u did the
job. No problems with RUBYEOF here (with vim 7.0d)

Cheers,

Steph.

On Wednesday 12 April 2006 19:38, Andrew T. wrote:

Well, once I stripped all the carraige returns from the .vim file, it
kinda worked. When I did ctrl+x ctrl+o it opened a list of classes, but
it always replaced whatever was under the cursor with TrueClass and
that’s all I could get it to do… Am I missing something?

I’m getting exactly the same results.

Mark

  • add the following to _vimrc
    autocmd FileType ruby,eruby
    set omnifunc=rbcomplete#Complete

with the recent versions of rubycomplete.vim the last line has to be

  set omnifunc=rubycomplete#Complete

Tried it with vim70e on linux and seems to be working great! Thanks for
this smart enhancement.

Cheers,

Steph.

Mark G. wrote:

Are you using 0.2, 0.4 or the current cvs head?
By default, when your not within a class, it returns a list of globals
and classes.
Originally the global code did not take into account input, the current
cvs head does (as does 0.4 I believe).
–mark

You should do proper releases then, not just uploading over the old
file… Where can I get 0.4?

Andrew

Mark S. wrote:

Mark

Are you using 0.2, 0.4 or the current cvs head?
By default, when your not within a class, it returns a list of globals
and classes.
Originally the global code did not take into account input, the current
cvs head does (as does 0.4 I believe).
–mark

Andrew T. wrote:

You should do proper releases then, not just uploading over the old
file… Where can I get 0.4?

Andrew

Same site
http://blog.hasno.info/blog/segfault/dev/2006/04/10/vim-7-ruby-omni-completion.html
I will update the blog entry to note the current version,
rubycomplete.vim is actually just a symlink to
rubycomplete-0.4.vim currently. There was also another ANN email sent
regarding 0.4.
–mark