简体   繁体   English

在Ruby中私有/公共/受保护的方法之后使vim缩进

[英]Make vim indent after private/public/protected methods in Ruby

My team have agreed to follow the Rails convention guideline regarding private/public/protected methods indenting. 我的团队已同意遵循有关私有/公共/受保护方法缩进的Rails公约准则。 Which is: http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions 即: http : //edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions

But I haven't found anything on how to make vim-ruby work this way. 但是我还没有找到如何使vim-ruby如此工作的任何方法。 How can I do this? 我怎样才能做到这一点?

Thanks! 谢谢!

This is a few months late, but I was looking for the same feature with vim-ruby and it didn't exist yet. 这已经晚了几个月,但是我一直在寻找与vim-ruby相同的功能,但是它还不存在。 I ended up proposing this and with the help of AndrewRadev we implemented this feature: https://github.com/vim-ruby/vim-ruby/pull/177 https://github.com/vim-ruby/vim-ruby/pull/179 我最终提出了这个建议,并在AndrewRadev的帮助下实现了此功能: https : //github.com/vim-ruby/vim-ruby/pull/177 https://github.com/vim-ruby/vim-ruby /拉/ 179

With the latest vim-ruby, you can set: 使用最新的vim-ruby,您可以设置:

let g:ruby_indent_access_modifier_style="indent"

in your ~/.vimrc and indentation will work as outlined in the Rails convention guide. 在〜/ .vimrc中,缩进将按照Rails约定指南中的说明工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM