Skip to content

Instantly share code, notes, and snippets.

@vindarel
Created November 17, 2014 11:45
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 vindarel/c1b8ce295a873d48b76f to your computer and use it in GitHub Desktop.
Save vindarel/c1b8ce295a873d48b76f to your computer and use it in GitHub Desktop.
Discover yafolding commands
;; Goal: have a magit-like menu to discover yafolding commands.
;; we use Mickey's version https://github.com/mickeynp/discover.el
;; We get a shorcut (M-f) which displays a list of actions associated with a hot key:
;; h will be for `yafolding-hide-element`, H to hide all, s to show the element, etc.
;; evil-mode users will need:
(evil-set-initial-state 'makey-key-mode 'emacs)
(discover-add-context-menu
:context-menu '(yafolding
(description "folding based on indentation")
(lisp-switches ;; to adapt if neeeded
("-cf" "Case should fold search" case-fold-search t nil))
(lisp-arguments ;; to adapt
("=l" "context lines to show (occur)"
"list-matching-lines-default-context-lines"
(lambda (dummy) (interactive) (read-number "Number of context lines to show: "))))
(actions
("yafolding"
("h" "yafolding hide element" yafolding-hide-element)
("s" "show element" yafolding-show-element)
("H" "hide all" yafolding-hide-all)
("S" "show all" yafolding-show-all))
))
:bind "M-f")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment