greyblake / vim-preview

Vim plugin for previewing markup files(markdown,rdoc,textile,html)
GNU General Public License v2.0
209 stars 29 forks source link

missing dependency error even though it's present (bluecloth) #17

Closed devth closed 12 years ago

devth commented 12 years ago

I keep getting the To preview markdown format you need to install the bluecloth gem error when trying to run vim-preview. I use rvm, but I tried installing bluecloth on all my rubies (including system). I also ran !sudo gem install bluecloth inside vim, but the error still appears.

:!ruby -v gives ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] which is system ruby.

greyblake commented 12 years ago

Hm.. Pretty strange issue. Do you have a similar trouble when you're trying to preview textile(RedCloth gem)? :!ruby -v shows an information about ruby in your environment, but Vim can use another one.

Could you please save the next file:

ruby <<RUBY_CODE
    puts RUBY_DESCRIPTION
    require 'rubygems'
    require 'bluecloth'
RUBY_CODE

And then type in your Vim keeping the file opened :so % What output do you get?

devth commented 12 years ago

I get

ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.8.0]
Error detected while processing /Users/trevorhartman/Desktop/vim_ruby_test:
line    5:
LoadError: no such file to load -- bluecloth

So apparently vim uses my rvm's 1.9.2 (which is my default ruby). In my terminal I verified that I have bluecloth in my gem list when using 1.9.2.

I get the same "RedCloth required" error when trying textile, after having installed RedCloth on my rvm ruby.

greyblake commented 12 years ago

I don't think Vim uses ruby from rvm. I guess you might have gem1.9 or similar command. Or try to specify full path to gem command like this: /usr/bin/gem install bluecloth

devth commented 12 years ago

Hmm, still no luck :/ Thanks for your help.

devth commented 12 years ago

I followed the advice at http://beginrescueend.com/integration/vim/ for MacVim integration, and sourced rvm in ~/.zshenv instead of ~/.zshrc. I no longer get the bluecloth missing error, and instead am getting:

Error detected while processing function <SNR>65_Preview..preview#show:
line    4:
NoMethodError: undefined method `flush' for #<Object:0x000001028557c0>  

Update: the file you previously asked me to :so % now runs without error.

greyblake commented 12 years ago

I was about to offer to you to execute the next Vim script:

ruby <<RUBY_CODE
    require 'rubygems'
    require 'rubygems/gem_runner'
    Gem::GemRunner.new.run ['install', 'bluecloth']
RUBY_CODE

It seems to be a common issue for MacVim with Ruby 1.9.2. The ticket already exists: https://github.com/greyblake/vim-preview/issues/10 Unfortunately I don't have an appropriate environment to reproduce this bug ( I am a linux user). :(

But I'm gonna create a patch could you please help me to test it?

devth commented 12 years ago

Absolutely.

greyblake commented 12 years ago

Please try branch ruby192.

devth commented 12 years ago

On ruby192 I still get

Error detected while processing function <SNR>65_Preview..preview#show:
line    4:
NoMethodError: undefined method `flush' for #<Object:0x0000010205a5c0>    
greyblake commented 12 years ago

Thanks for try. It looks like there are some issue in Vim with Ruby 1.9.2: http://vim.1045645.n5.nabble.com/Is-vim-7-3-ready-for-compiling-with-ruby-1-9-2-support-td4410535.html