-
-
Save larsthegeek/59b64046c163cf54ea72 to your computer and use it in GitHub Desktop.
Spacemacs: Code folding for ruby-mode
This file contains hidden or 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment