In languages with braces { ... }
around a function or method, it is easy to select the inner body definition of a method (see Selecting entire function definition in Vim):
You can select the inner body with vi{
or including the curly braces with va}
.
However in Ruby, you don't have these. Methods are written with the def ... end
syntax with optional round brackets:
def foo(bar)
puts "foo: #{bar}"
end
def bar
puts "bar"
end
Is there a way, to only select the inner body puts "foo"
of a method in Ruby? How about the whole method definition?
CodePudding user response:
The built-in Ruby ftplugin adds, among other things, a bunch of custom pseudo-text objects, so you can do vim
or vam
.
While the feature is documented in the project itself, it appears to not be in Vim itself, though, so you should probably ask the maintainers to improve that aspect of their project.