wincent / command-t

⌨️ Fast file navigation for Neovim and Vim
BSD 2-Clause "Simplified" License
2.74k stars 317 forks source link

Instructions for compiling when using rvm and brew #361

Closed bmulholland closed 4 years ago

bmulholland commented 4 years ago

Homebrew now has ruby listed as a dependency for both vim and macvim, which means there are version conflicts together with RVM (and likely rbenv). I have confirmed that the comment at https://github.com/wincent/command-t/issues/341#issuecomment-522216390 fixes this issue (for my computer running Catalina and macvim from homebrew), and am adding these to the instructions so they are easier for others to find.

beerlington commented 4 years ago

@bmulholland I spent hours last night trying to figure this out. Can confirm it works 🥂

adamsx97 commented 4 years ago

@beerlington You can read my latest solution. I think it might help you: https://github.com/wincent/command-t/issues/350#issuecomment-545681813. Btw, I am also running the latest macOS Catalina. Feel free to ask questions.

Domon commented 4 years ago

This saved my day.

@wincent Is there any reason why this couldn't be merged? 🤔

bhurlow commented 4 years ago

❇️ nice!!

kyletolle commented 4 years ago

I can't tell you how many times I've fought with command-t to use the correct version of Ruby across macvim/macos/ruby version changes. It's a true struggle. I love the project and the functionality, so it's something I keep fighting to keep working. Each time I try a bunch of stuff, eventually stumbling into a solution. Tonight this /usr/local/opt/ruby/bin/ruby path was the fix I needed. Thanks for the PR!

I use rbenv for Ruby normally. Here's the final set of commands I seem to have needed to get it working:

brew uninstall macvim
brew uninstall ruby
brew install ruby
brew install macvim
cd ~/.vim/bundle/command-t/ruby/command-t/ext/command-t
git pull
rm *.o && rm ext.bundle && rm metadata.rb && rm Makefile && /usr/local/opt/ruby/bin/ruby extconf.rb && make

Finally, I opened macvim, which I have aliased to gvim, and did <Leader>t and saw that it worked.

I hope these steps help someone else!

wincent commented 4 years ago

I can't tell you how many times I've fought with command-t to use the correct version of Ruby across macvim/macos/ruby version changes. It's a true struggle.

Yeah, I'm well aware of the pain. This is why I don't mess with Ruby on my system, at all. I just use the boring old /usr/bin/ruby that comes with macOS (that's 2.3.7 on the version that I'm using, which is 10.13.6). It's simply not worth tinkering with. Of course, not everybody has the luxury of running with the stock Ruby (some people's work, for example, obliges them to run different versions).

I do have a plan to rewrite Command-T to make installation easier but it will always have a Ruby component. The idea is to move it outside of the Vim process into a separate process to isolate it from the problem with version mismatches (see https://github.com/wincent/command-t/issues/220). The thing is, though, it's not a high priority — as you can tell from the age of that issue — given that the plug-in does actually work... I would love to do it, but there is only so much time and there are other bigger fish to fry in other projects, rather than re-solving an already-solved problem by rewriting this project. But one day, I'll get to it. The other related thing is to reduce the amount of Ruby in the plug-in (https://github.com/wincent/command-t/issues/281), but that in itself won't address the hard-to-install problem; the only way to do that is to get all compiled Ruby out of the Vim process.

Needless to say, if I have to rewrite everything, I will probably drop support for older versions of Vim (maybe even just starting with Neovim support alone), because otherwise the project is just too big to actually get done. An example here would be using Neovim's floating window API to replace a bunch of Ruby code that is currently abusing normal Vim buffers to display the match listing.

bmulholland commented 4 years ago

@wincent That does sound like a lot of work, and totally get why it's been so long. Given that it doesn't seem likely to change for a while, what would you think about merging this README PR update to help others with how things are now? FWIW, I've referred back to this PR 2-3 times since I filed it just to get the commands to run, and seems like it's been helpful to others.

wincent commented 4 years ago

Yeah, I can merge it. I was holding off because of fear of the butterfly effect. So many possible variables, that doubtless as soon as I merge it will end up leading somebody down the wrong path even as it helps another. 😂