AndrewRadev / vimrunner

Control a vim instance through ruby code
MIT License
238 stars 13 forks source link

Vim path not being set #28

Closed iurifq closed 11 years ago

iurifq commented 11 years ago

I've been trying to get vimrunner to work with my fork of vim-elixir without success. I'm practically copying the spec_helper.rb from vim-ruby but it still does not work. I think this call for prepend_runtimepath somehow is not working.

 config.before(:suite) do
   VIM = Vimrunner.start_gvim
   VIM.prepend_runtimepath(File.expand_path('../..', __FILE__))
 end

In vim-elixir, the ftdetect is not being loaded as well the other files from the project. Is this the right way to do it?

AndrewRadev commented 11 years ago

It turns out I've never needed to use an ftdetect, oddly enough :). According to the Vim documentation, anything added to ftdetect needs a restart in order to work. I assume it works for vim-ruby, since the ruby autocommands are in the standard runtime files anyway.

For now, a solution to the problem is to simply runtime the detection file itself:

config.before(:suite) do
   VIM = Vimrunner.start_gvim
   VIM.prepend_runtimepath(File.expand_path('../..', __FILE__))
   VIM.command('runtime ftdetect/elixir.vim')
 end

The filetype seems to be detected fine after this -- some of the specs are failing, but I think they're simply not ready yet. For example, the "if-else" spec needs a "else:" instead of "else". I don't really know elixir, though, so I can't help you out with that :). Could you also try it out and let me know if this solution works for you?

Also, we recently added a simple RSpec adapter. Here's the relevant documentation: https://github.com/AndrewRadev/vimrunner/blob/master/README.md#testing. If you'd like, you can try this one out instead, we were hoping this would help the initial bootstrapping process.

iurifq commented 11 years ago

Thank you for the reply. I could get it done by adding each file individually, but I'll try to do as you said.

In Elixir is possible to use else and else: depending on which block syntax you want to use. Actually, the example is right for what I want to test ;)

Also, we recently added a simple RSpec adapter. Here's the relevant documentation: https://github.com/AndrewRadev/vimrunner/blob/master/README.md#testing. If you'd like, you can try this one out instead, we were hoping this would help the initial bootstrapping process.

Cool, I haven't seen this before. I'll give it a try later. Thanks again

iurifq commented 11 years ago
   VIM.command('runtime ftdetect/elixir.vim')

Thanks again, the line above really did the trick.

I've tried to use the RSpec adapter but I couldn't make it work out of the box. I'll take a look at that later more carefully. IMHO, you should create a matcher to do exactly what you show in the example of you're README while testing the indentation. It would avoid the repetition of all this boiler plate to simply test the indentation of a file.

Closing this.

AndrewRadev commented 11 years ago

An indentation assertion does sound like a good idea. Thanks for the suggestion, I'll consider adding it to the Vimrunner::Testing module.