|
| 1 | +RUBY *ft-ruby-indent* |
| 2 | + |
| 3 | + Ruby: Access modifier indentation |ruby-access-modifier-indentation| |
| 4 | + Ruby: Block style indentation |ruby-block-style-indentation| |
| 5 | + Ruby: Assignment style indentation |ruby-assignment-style-indentation| |
| 6 | + |
| 7 | + *ruby-access-modifier-indentation* |
| 8 | + *g:ruby_indent_access_modifier_style* |
| 9 | + Ruby: Access modifier indentation ~ |
| 10 | + |
| 11 | +Different access modifier indentation styles can be used by setting: > |
| 12 | +
|
| 13 | + :let g:ruby_indent_access_modifier_style = 'normal' |
| 14 | + :let g:ruby_indent_access_modifier_style = 'indent' |
| 15 | + :let g:ruby_indent_access_modifier_style = 'outdent' |
| 16 | +< |
| 17 | +By default, the "normal" access modifier style is used. |
| 18 | + |
| 19 | +Access modifier style "normal": |
| 20 | +> |
| 21 | + class Indent |
| 22 | + private :method |
| 23 | + protected :method |
| 24 | + private |
| 25 | + def method; end |
| 26 | + protected |
| 27 | + def method; end |
| 28 | + public |
| 29 | + def method; end |
| 30 | + end |
| 31 | +< |
| 32 | +Access modifier style "indent": |
| 33 | +> |
| 34 | + class Indent |
| 35 | + private :method |
| 36 | + protected :method |
| 37 | + private |
| 38 | + def method; end |
| 39 | + protected |
| 40 | + def method; end |
| 41 | + public |
| 42 | + def method; end |
| 43 | + end |
| 44 | +< |
| 45 | +Access modifier style "outdent": |
| 46 | +> |
| 47 | + class Indent |
| 48 | + private :method |
| 49 | + protected :method |
| 50 | + private |
| 51 | + def method; end |
| 52 | + protected |
| 53 | + def method; end |
| 54 | + public |
| 55 | + def method; end |
| 56 | + end |
| 57 | +< |
| 58 | + *ruby-block-style-indentation* |
| 59 | + *g:ruby_indent_block_style* |
| 60 | + Ruby: Block style indentation ~ |
| 61 | + |
| 62 | +Different block indentation styles can be used by setting: > |
| 63 | +
|
| 64 | + :let g:ruby_indent_block_style = 'expression' |
| 65 | + :let g:ruby_indent_block_style = 'do' |
| 66 | +< |
| 67 | +By default, the "expression" block indent style is used. |
| 68 | + |
| 69 | +Block indent style "expression": |
| 70 | +> |
| 71 | + first |
| 72 | + .second do |x| |
| 73 | + something |
| 74 | + end |
| 75 | +< |
| 76 | +Block indent style "do": |
| 77 | +> |
| 78 | + first |
| 79 | + .second do |x| |
| 80 | + something |
| 81 | + end |
| 82 | +< |
| 83 | + |
| 84 | + *ruby-assignment-style-indentation* |
| 85 | + *g:ruby_indent_assignment_style* |
| 86 | + Ruby: Assignment style indentation ~ |
| 87 | + |
| 88 | +Different styles of indenting assignment for multiline expressions: |
| 89 | +> |
| 90 | + :let g:ruby_indent_assignment_style = 'hanging' |
| 91 | + :let g:ruby_indent_assignment_style = 'variable' |
| 92 | +< |
| 93 | +By default, the "hanging" style is used. |
| 94 | + |
| 95 | +Assignment indent style "hanging": |
| 96 | +> |
| 97 | + x = if condition |
| 98 | + something |
| 99 | + end |
| 100 | +< |
| 101 | +Assignment indent style "variable": |
| 102 | +> |
| 103 | + x = if condition |
| 104 | + something |
| 105 | + end |
| 106 | +< |
| 107 | + |
| 108 | + |
| 109 | + vim:tw=78:sw=4:ts=8:ft=help:norl: |
0 commit comments