origami.el icon indicating copy to clipboard operation
origami.el copied to clipboard

fyi ;; Support for Searching and a Hydra for Super Quick Navigation

Open alhassy opened this issue 6 years ago • 0 comments

I've settled on origami as my main folding mode, and below are somethings I've found helpful ---and wished would have been in the Readme, so I'm posting them here in case any lookers come by.


Support for searching:

(defun my/search-hook-function ()
  (when origami-mode (origami-toggle-node (current-buffer) (point))))

;; Open folded nodes if a search stops there.
(add-hook 'helm-swoop-after-goto-line-action-hook #'my/search-hook-function)
;;
;; Likewise for incremental search, isearch, users.
;; (add-hook 'isearch-mode-end-hook #'my/search-hook-function)

A hydra for super quick navigation and easily folding, unfolding blocks! Love this one ^_^

(defhydra folding-with-origami-mode (global-map "C-c f")
  ("h" origami-close-node-recursively "Hide")
  ("o" origami-open-node-recursively  "Open")
  ("t" origami-toggle-all-nodes  "Toggle buffer")
  ("n" origami-next-fold "Next")
  ("p" origami-previous-fold "Previous"))

alhassy avatar Sep 23 '19 14:09 alhassy