PATCH: include gems load path in 'path'

Doug Kearns dougkearns at gmail.com
Tue Sep 27 10:38:22 EDT 2005


On Sun, Sep 11, 2005 at 07:39:38PM +1000, Doug Kearns wrote:
> 
> This includes the gems load path in 'path' so that :find and friends
> will search there first.
> 
> Is my limited understanding of gems correct?

This should be an improvement.

Because of the multiple directory approach Gems takes the 'path' may be
__very__ long... ;-) Perhaps this inclusion of the Gems search path
should be configurable?

Regards,
Doug


Index: ftplugin/ruby.vim
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/ftplugin/ruby.vim,v
retrieving revision 1.13
diff -u -r1.13 ruby.vim
--- ftplugin/ruby.vim	27 Sep 2005 05:08:01 -0000	1.13
+++ ftplugin/ruby.vim	27 Sep 2005 14:28:56 -0000
@@ -66,10 +66,11 @@
 
 if !exists("s:rubypath")
   if executable("ruby")
+    let s:code = "print ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,})"
     if &shellxquote == "'"
-      let s:rubypath = system('ruby -e "print (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})"')
+      let s:rubypath = system('ruby -e "' . s:code . '"')
     else
-      let s:rubypath = system("ruby -e 'print (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})'")
+      let s:rubypath = system("ruby -e '" . s:code . "'")
     endif
     let s:rubypath = substitute(s:rubypath, '\%(^\|,\)\.\%(,\|$\)', ',,', '')
   else


More information about the vim-ruby-devel mailing list