Integrate new code folding more aggressively

This is necessary for +evil/fold-{open,close}-all to recieve its
interactive <c> argument.
This commit is contained in:
Henrik Lissner 2017-05-28 12:44:41 +02:00
parent 86cca42723
commit 47afa2f51c
2 changed files with 21 additions and 7 deletions

View file

@ -46,15 +46,21 @@
;;;###autoload (autoload '+evil/fold-open-all "feature/evil/autoload/folds" nil t) ;;;###autoload (autoload '+evil/fold-open-all "feature/evil/autoload/folds" nil t)
(evil-define-command +evil/fold-open-all (&optional level) (evil-define-command +evil/fold-open-all (&optional level)
"Open folds at LEVEL (or all folds if LEVEL is nil)."
(interactive "<c>") (interactive "<c>")
(vimish-fold-unfold-all) (vimish-fold-unfold-all)
(if level (hs-hide-level level) (hs-show-all))) (if (integerp level)
(hs-hide-level (1- level))
(hs-show-all)))
;;;###autoload (autoload '+evil/fold-close-all "feature/evil/autoload/folds" nil nil) ;;;###autoload (autoload '+evil/fold-close-all "feature/evil/autoload/folds" nil t)
(evil-define-command +evil/fold-close-all (&optional level) (evil-define-command +evil/fold-close-all (&optional level)
"Close folds at LEVEL (or all folds if LEVEL is nil)."
(interactive "<c>") (interactive "<c>")
(vimish-fold-refold-all) (vimish-fold-refold-all)
(if level (hs-hide-level level) (hs-hide-all))) (if (integerp level)
(hs-hide-level (1- level))
(hs-hide-all)))
;; --- misc ------------------------------- ;; --- misc -------------------------------

View file

@ -76,10 +76,18 @@
;; --- keybind fixes ---------------------- ;; --- keybind fixes ----------------------
(after! wgrep (map! (:after wgrep
;; a wrapper that invokes `wgrep-mark-deletion' across lines ;; a wrapper that invokes `wgrep-mark-deletion' across lines
;; you use `evil-delete' on. ;; you use `evil-delete' on.
(map! :map wgrep-mode-map [remap evil-delete] #'+evil-delete)) :map wgrep-mode-map [remap evil-delete] #'+evil-delete)
;; replace native folding commands
:n "zo" #'+evil/fold-open
:n "zO" #'+evil/fold-open
:n "zc" #'+evil/fold-close
:n "za" #'+evil/fold-toggle
:n "zr" #'+evil/fold-open-all
:n "zm" #'+evil/fold-close-all)
;; --- evil hacks ------------------------- ;; --- evil hacks -------------------------