feat(tree-sitter): add ts to open/close all
also refactor +fold-open-all, +fold-close-all to use cond instead of the when case for vimish fold.
This commit is contained in:
parent
c3e360eeaa
commit
7b9d00d661
1 changed files with 23 additions and 19 deletions
|
@ -109,9 +109,11 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
|
|||
"Open folds at LEVEL (or all folds if LEVEL is nil)."
|
||||
(interactive
|
||||
(list (if current-prefix-arg (prefix-numeric-value current-prefix-arg))))
|
||||
(when (featurep 'vimish-fold)
|
||||
(cond ((+fold--ts-fold-p)
|
||||
(ts-fold-open-all))
|
||||
((featurep 'vimish-fold)
|
||||
(vimish-fold-unfold-all))
|
||||
(save-excursion
|
||||
(t (save-excursion
|
||||
(+fold--ensure-hideshow-mode)
|
||||
(if (integerp level)
|
||||
(progn
|
||||
|
@ -120,7 +122,7 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
|
|||
(hs-hide-level-recursive (1- level) (point-min) (point-max))))
|
||||
(hs-show-all)
|
||||
(when (fboundp 'outline-show-all)
|
||||
(outline-show-all)))))
|
||||
(outline-show-all)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold/close-all (&optional level)
|
||||
|
@ -128,13 +130,15 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
|
|||
(interactive
|
||||
(list (if current-prefix-arg (prefix-numeric-value current-prefix-arg))))
|
||||
(save-excursion
|
||||
(when (featurep 'vimish-fold)
|
||||
(cond ((+fold--ts-fold-p)
|
||||
(ts-fold-close-all))
|
||||
(t (when (featurep 'vimish-fold)
|
||||
(vimish-fold-refold-all))
|
||||
(+fold--ensure-hideshow-mode)
|
||||
(hs-life-goes-on
|
||||
(if (integerp level)
|
||||
(hs-hide-level-recursive (1- level) (point-min) (point-max))
|
||||
(hs-hide-all)))))
|
||||
(hs-hide-all)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold/next (count)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue