Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rufo fails to run after triggering rails omnicompletion #22

Open
ralfthewise opened this issue Jun 26, 2018 · 1 comment
Open

rufo fails to run after triggering rails omnicompletion #22

ralfthewise opened this issue Jun 26, 2018 · 1 comment

Comments

@ralfthewise
Copy link

Repro:

[tim@hood]$ cat <<EOF > /tmp/vimrc
set nocompatible
call plug#begin()
Plug 'ruby-formatter/rufo-vim'
call plug#end()
syntax on
filetype on
filetype indent on
filetype plugin on
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
EOF

[tim@hood]$ vim -u /tmp/vimrc config/initializers/kaminari_config.rb

# trigger omnicompletion somewhere by entering edit mode and hitting CTRL-x CTRL-o
# then try issuing the :Rufo command - you'll see this error output:
/usr/local/rvm/gems/ruby-2.5.1/gems/bundler-1.16.1/lib/bundler/rubygems_integration.rb:458:in `block in replace_bin_path': can't find executable rufo for gem rufo. rufo is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
        from /usr/local/rvm/gems/ruby-2.5.1/gems/bundler-1.16.1/lib/bundler/rubygems_integration.rb:478:in `block in replace_bin_path'
        from /usr/local/rvm/gems/ruby-2.5.1/bin/rufo:27:in `<main>'
        from /usr/local/rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:15:in `eval'
        from /usr/local/rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:15:in `<main>'

I have rufo installed globally, not in the bundle. I use junegunn/vim-plug for vim plugin management, but I'm guessing that has no bearing on this issue. Prior to triggering omnicompletion rufo runs fine.

@ralfthewise
Copy link
Author

ralfthewise commented Jun 26, 2018

Looks like this is caused by omnicompletion loading the bundle which then breaks rufo. These environment variables seem to be the main culprits: GEM_HOME GEM_PATH and RUBYOPT. Doing something like:

let l:out = systemlist('echo ' . shellescape(l:selection) . '| ruby -e "defined?(Bundler) ? Bundler.with_clean_env { system(%(rufo)) } : system(%(rufo))"')

may work, but wondering if that would break things for someone who only has rufo installed as part of a bundle. Will have to do some testing and hopefully submit a PR in the next couple days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant