direnv / direnv.vim

vim plugin for direnv support
MIT License
182 stars 12 forks source link

Loading problem neovim #29

Open mikezaby opened 2 years ago

mikezaby commented 2 years ago

I am using direnv with a setup like this https://juliu.is/ditch-your-version-manager/ I have a Ruby On Rails project and I think that somethink not loading correctly in neovim, while with vim is working properly.

I am running the following commands to demonstrate the problem

!which ruby
/nix/store/fv8mr37kp374slp1b8dq231wqprb85fa-ruby-2.7.5/bin/ruby
:!which bundle
/nix/store/fv8mr37kp374slp1b8dq231wqprb85fa-ruby-2.7.5/bin/bundle
:!bundle exec rails
/nix/store/fv8mr37kp374slp1b8dq231wqprb85fa-ruby-2.7.5/lib/ruby/2.7.0/bundler/definition.rb:495:in `validate_ruby!': Your Ruby version is 2.6.8, but your Gemfile specified 2.7.5 (Bundler::RubyVersionMismatch)
        from /nix/store/fv8mr37kp374slp1b8dq231wqprb85fa-ruby-2.7.5/lib/ruby/2.7.0/bundler/definition.rb:470:in `validate_runtime!'
        from /nix/store/fv8mr37kp374slp1b8dq231wqprb85fa-ruby-2.7.5/lib/ruby/2.7.0/bundler.rb:143:in `setup'
        from /nix/store/fv8mr37kp374slp1b8dq231wqprb85fa-ruby-2.7.5/lib/ruby/2.7.0/bundler/setup.rb:20:in `block in <top (required)>'
        from /nix/store/fv8mr37kp374slp1b8dq231wqprb85fa-ruby-2.7.5/lib/ruby/2.7.0/bundler/ui/shell.rb:136:in `with_level'
        from /nix/store/fv8mr37kp374slp1b8dq231wqprb85fa-ruby-2.7.5/lib/ruby/2.7.0/bundler/ui/shell.rb:88:in `silence'
        from /nix/store/fv8mr37kp374slp1b8dq231wqprb85fa-ruby-2.7.5/lib/ruby/2.7.0/bundler/setup.rb:20:in `<top (required)>'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'

shell returned 1

For some reason is trying to use system ruby

felschr commented 2 years ago

Does it work after you manually run :DirenvExport?

I have the same or a similar issue with neovim. After opening a project from vim-startify I need to run :DirenvExport for the environment to load. If I open vim in the project directory directly, the direnv environment loads fine, though. So this seems to be an issue with vim-startify in some way, probably an issue with the DirChanged autocmd.

felschr commented 2 years ago

I've just switched to alpha-nvim and the issue is gone.