forked from vim-ruby/vim-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vim-ruby.txt
107 lines (85 loc) · 2.8 KB
/
vim-ruby.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
*vim-ruby.txt*
1. Ruby motions |ruby-motion|
2. Ruby text objects |ruby-text-objects|
3. Access modifier indentation |ruby-text-objects|
==============================================================================
1. Ruby motions *ruby-motion*
Vim provides motions such as |[m| and |]m| for jumping to the start or end of
a method definition. Out of the box, these work for curly-bracket languages,
but not for ruby. The |vim-ruby| plugin enhances these motions, by making them
also work on ruby files.
*ruby-]m*
]m Go to start of next method definition.
*ruby-]M*
]M Go to end of next method definition.
*ruby-[m*
[m Go to start of previous method definition.
*ruby-[M*
[M Go to end of previous method definition.
*ruby-]]*
]] Go to start of next module or class definition.
*ruby-][*
][ Go to end of next module or class definition.
*ruby-[[*
[[ Go to start of previous module or class definition.
*ruby-[]*
[] Go to end of previous module or class definition.
==============================================================================
2. Ruby text objects *ruby-text-objects*
Vim's |text-objects| can be used to select or operate upon regions of text
that are defined by structure. The |vim-ruby| plugin adds text objects for
operating on methods and classes.
*ruby-v_am* *ruby-am*
am "a method", select from "def" until matching "end"
keyword.
*ruby-v_im* *ruby-im*
im "inner method", select contents of "def"/"end" block,
excluding the "def" and "end" themselves.
*ruby-v_aM* *ruby-aM*
aM "a class", select from "class" until matching "end"
keyword.
*ruby-v_iM* *ruby-iM*
iM "inner class", select contents of "class"/"end"
block, excluding the "class" and "end" themselves.
==============================================================================
3. Access modifier indentation *ruby-motion*
Different access modifier indentation styles can be used by setting: >
:let g:ruby_indent_access_modifier_style = 'normal'
:let g:ruby_indent_access_modifier_style = 'indent'
:let g:ruby_indent_access_modifier_style = 'outdent'
<
By default, the normal access modifier style is used.
Access modifier style 'normal':
class Indent
private :method
protected :method
private
def method; end
protected
def method; end
public
def method; end
end
Access modifier style 'indent':
class Indent
private :method
protected :method
private
def method; end
protected
def method; end
public
def method; end
end
Access modifier style 'outdent':
class Indent
private :method
protected :method
private
def method; end
protected
def method; end
public
def method; end
end
vim:tw=78:sw=4:ts=8:ft=help:norl: