Vim Indentation File for Treetop (Ruby Analyzer)

Has anyone seen the indent vim file for treetop , a Ruby parser / generator? I found the vim syntax highlighting file but did not see it for indentation.

+6
ruby vim indentation treetop
source share
4 answers

It seems to be pretty easy - I just create a file

~/.vim/indent/treetop.vim 

and make it the only content

 runtime! indent/ruby.vim 

and it seems to support everything I need. I think I just did not load the Ruby indentation file!

+2
source share
0
source share

I searched for this a while ago for Vim or Emacs and couldn't find anything, so I started writing my own mode for Emacs. This did not lead to anything, since I pretty much stopped using TT, but if my memory is not necessary, you only need to parse something:

 grammar Name includes # something like "include Something" rule rule_name tokens_or_rules { inner_method { } } <MyModule> end end 

Which may not be too hard after reading this .

PS: Keep in mind that this grammar is really similar to the one used by RSpec, which is a natural Ruby, so maybe you can get some help by reading this.

-one
source share

I'm not sure if there is a direct ruby ​​implementation, but the vim rails plugin does a great job of indenting.

You can always simply edit this to support ruby ​​files that are not part of the rails project. Check this.
-3
source share

All Articles