1

When editing ruby, some files but not all are garbled when editing in vim.

Inspecting the options with :set, I discovered that there is some magic done to produce one of the option values, and something went wrong with the magic and there is an error or warning message where the option value should be. That may be causing side effects.

The method throwing the error is Gem.all_load_paths, and it happens regardless of whether I use ruby 1.8.7, 1.9.2, whether I use rvm or system ruby. Using Ubuntu 11.10

I've tried setting the omnifunc option to nil, but that doesn't solve the problem; it seems to be a different option producing this value. The plugins I'm using can be seen below.

:set --- Options --- autoindent comments=:# history=50 keywordprg=ri scroll=29 suffixesadd=.rb ttyfast backup filetype=ruby hlsearch mouse=a shiftwidth=2 syntax=ruby ttymouse=xterm2 backupdir=~/.tmp helplang=en incsearch ruler showcmd tabstop=2 backspace=indent,eol,start balloonexpr=RubyBalloonexpr() commentstring=# %s fileencodings=ucs-bom,utf-8,default,latin1 formatoptions=croql include=^\s*\<\(load\|w*require\)\> includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','') indentexpr=GetRubyIndent() indentkeys=0{,0},0),0],!^F,o,O,e,=end,=elsif,=when,=ensure,=rescue,==begin,==end omnifunc=rubycomplete#Complete f rom ~/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/deprecate.rb:62:in `all_load_paths'^@^Ifrom -e:1^@1.8/rubygems/deprecate.rb:62:in `send'^@^I printoptions=paper:letter / after,/var/lib/vim/addons/after,~/.vim/afterm,~/.vim/bundle/vim-rails,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc 
1
  • The option that contains the offending value is the path option. I spent more time ruling out possible causes, removing plugins, etc. The output of :set has changed now, and all plugins back in place. I think opening and closing and opening my shell was the most recent think I did before noticing the change. The editor is usable now, and the files don't become hopelessly garbled. However, within the value of path, there is still a notice that Gem.all_load_paths is deprecated. Commented Jan 6, 2012 at 21:21

2 Answers 2

1

I got the same thing today after updating from Snapshot 63 to Snapshot 64 of MacVim. It's an ugly hack, but I found the offending line (79) in MacVim.app/Contents/Resources/vim/runtime/ftplugin/ruby.vim and removed the reference to Gem.all_load_paths, which is deprecated with no replacement.

I've posted a diff of my gist that gets me going. It's not clear to me at this point if this is a bug to be reported against MacVim or Vim.

Sign up to request clarification or add additional context in comments.

Comments

1

I built on @pbyme a little bit and actually found the new way to do it. With my current setup, it's even pulling in some local gems brought in by bundler.

The key is replacing all_load_paths with Specification.map(&:lib_dirs_glob)

MacVim.app/Contents/Resources/vim/runtime/ftplugin/ruby.vim

79c79 < let s:code = "print ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,})" --- > let s:code = "print ($: + begin; require %q{rubygems}; Gem::Specification.map(&:lib_dirs_glob).sort.uniq; rescue LoadError; []; end).join(%q{,})" 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.