Created
November 17, 2014 11:45
-
-
Save vindarel/c1b8ce295a873d48b76f to your computer and use it in GitHub Desktop.
Discover yafolding commands
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
;; 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