Created
March 18, 2016 11:40
-
-
Save littlemove/5c55dfe0bb724f4420c0 to your computer and use it in GitHub Desktop.
Spacemacs: Code folding for ruby-mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Code folding | |
(add-hook 'ruby-mode-hook | |
(lambda () (hs-minor-mode))) | |
(eval-after-load "hideshow" | |
'(add-to-list 'hs-special-modes-alist | |
`(ruby-mode | |
,(rx (or "def" "class" "module" "do" "{" "[")) ; Block start | |
,(rx (or "}" "]" "end")) ; Block end | |
,(rx (or "#" "=begin")) ; Comment start | |
ruby-forward-sexp nil))) | |
(global-set-key (kbd "C-c h <left>") 'hs-hide-block) | |
(global-set-key (kbd "C-c h <right>") 'hs-show-block) | |
(global-set-key (kbd "C-c h <up>") 'hs-hide-level) |
Thanks a lot. Its working
Thanks!
I found removing "class" "module"
makes evil-close-folds (z m)
behave as I was expecting.
i.e. fold all children of a class or module.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks. It works perfectly fine.