Skip to content

Instantly share code, notes, and snippets.

@hlissner
Created June 21, 2018 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hlissner/a62e307c5027777186af883fde08a679 to your computer and use it in GitHub Desktop.
Save hlissner/a62e307c5027777186af883fde08a679 to your computer and use it in GitHub Desktop.
Adds hideshow folding rules for yaml-mode and ruby-mode
(defun +data-hideshow-forward-sexp (arg)
(let ((start (current-indentation)))
(forward-line)
(unless (= start (current-indentation))
(require 'evil-indent-plus)
(let ((range (evil-indent-plus--same-indent-range)))
(goto-char (cadr range))
(end-of-line)))))
(map-put hs-special-modes-alist
'yaml-mode
'("\\s-*\\_<\\(?:[^:]+\\)\\_>" "" "#" +data-hideshow-forward-sexp nil))
(map-put hs-special-modes-alist
'ruby-mode
'("\\(def\\|do\\|{\\)" "\\(end\\|end\\|}\\)" "#"
(lambda (arg) (ruby-end-of-block)) nil))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment