rubypath should be global in ftplugin/ruby.vim

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

rubypath should be global in ftplugin/ruby.vim

mattn

Hi all.

Starting vim with arguments '*.rb' is very slow. It cause vim search
ruby path from system call in 'ftplugin/ruby.vim'.
'ftplugin/perl.vim' check perlpath as global variable with
exists('perlpath').  I use poor spec machine, and I wrote followingin
my vimrc to ignore search .

let g:perlpath = ''

I think that ruby.vim should check global variable like 'perl.vim'

below is a patch. please check and include.

Index: runtime/ftplugin/ruby.vim
===================================================================
--- runtime/ftplugin/ruby.vim (revision 1318)
+++ runtime/ftplugin/ruby.vim (working copy)
@@ -69,26 +69,26 @@
 setlocal comments=:#
 setlocal commentstring=#\ %s

-if !exists("s:rubypath")
+if !exists("rubypath")
   if has("ruby") && has("win32")
-    ruby VIM::command( 'let s:rubypath = "%s"' % ($: + begin; require
%q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; [];
end).join(%q{,}) )
-    let s:rubypath = '.,' . substitute(s:rubypath,
'\%(^\|,\)\.\%(,\|$\)', ',,', '')
+    ruby VIM::command( 'let rubypath = "%s"' % ($: + begin; require
%q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; [];
end).join(%q{,}) )
+    let rubypath = '.,' . substitute(rubypath,
'\%(^\|,\)\.\%(,\|$\)', ',,', '')
   elseif 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 "' . s:code . '"')
+      let rubypath = system('ruby -e "' . s:code . '"')
     else
-      let s:rubypath = system("ruby -e '" . s:code . "'")
+      let rubypath = system("ruby -e '" . s:code . "'")
     endif
-    let s:rubypath = '.,' . substitute(s:rubypath,
'\%(^\|,\)\.\%(,\|$\)', ',,', '')
+    let rubypath = '.,' . substitute(rubypath,
'\%(^\|,\)\.\%(,\|$\)', ',,', '')
   else
     " If we can't call ruby to get its path, just default to using the
     " current directory and the directory of the current file.
-    let s:rubypath = ".,,"
+    let rubypath = ".,,"
   endif
 endif

-let &l:path = s:rubypath
+let &l:path=rubypath

 if has("gui_win32") && !exists("b:browsefilter")
   let b:browsefilter = "Ruby Source Files (*.rb)\t*.rb\n" .


--
- Yasuhiro Matsumoto

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: rubypath should be global in ftplugin/ruby.vim

Doug Kearns

On 1/15/09, Yasuhiro MATSUMOTO <[hidden email]> wrote:

>
>  Hi all.
>
>  Starting vim with arguments '*.rb' is very slow. It cause vim search
>  ruby path from system call in 'ftplugin/ruby.vim'.
>  'ftplugin/perl.vim' check perlpath as global variable with
>  exists('perlpath').  I use poor spec machine, and I wrote followingin
>  my vimrc to ignore search .
>
>  let g:perlpath = ''
>
>  I think that ruby.vim should check global variable like 'perl.vim'
>
>  below is a patch. please check and include.

Thanks. I'll add that or something similar.

Regards,
Doug

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---