I am using mvim an开发者_开发问答d I would like to fold the class Experiment. How do I do that?
class Lab
def method1
end
class Experiment
def method2
end
end # end of class Experiment
end # end of class Lab
If you'd like to fold a specific number of lines use zf
and then a motion command. For example, if you wanted to fold all the lines in class Experiment
, put your cursor onto the line reading def method2
, and type zf2j
. zf
is the fold command, 2
is the number of lines to fold below the current one, and j
indicates a downward cursor motion. The result will look like this:
class Lab
def method1
end
class Experiment
+--------------- 3 lines: def method2 -------------------------
end # end of class Lab
You can also use visual line mode to select what you'd like to fold and then type za
to fold/un-fold.
精彩评论