开发者

How to fold a class which is declared inside a class in ruby code

开发者 https://www.devze.com 2022-12-27 01:07 出处:网络
I am using mvim an开发者_开发问答d I would like to fold the class Experiment. How do I do that?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号