feature/evil: fix overzealous folding from :n TAB

Changes +evil/matchit-or-toggle-fold to be less trigger-happy about
toggling folds (it will only open folds not, not toggle them).

Also updates its docstring.
This commit is contained in:
Henrik Lissner 2018-09-20 22:27:15 -04:00
parent feabbc31da
commit 1b3511890e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -147,15 +147,16 @@
;;;###autoload
(defun +evil/matchit-or-toggle-fold ()
"Do what I mean. If on a fold-able element, toggle the fold with
`hs-toggle-hiding'. Otherwise, if on a delimiter, jump to the matching one with
`evilmi-jump-items'. If in a magit-status buffer, use `magit-section-toggle'."
"Do what I mean.
If in a magit-status buffer, use `magit-section-toggle'.
If on a folded element, unfold it.
Otherwise, jump to the matching delimiter with `evilmi-jump-items'."
(interactive)
(ignore-errors
(call-interactively
(cond ((derived-mode-p 'magit-mode)
#'magit-section-toggle)
((+evil-fold-p)
#'+evil:fold-toggle)
(t
#'evilmi-jump-items)))))
((+evil-from-eol (invisible-p (point)))
#'+evil/fold-toggle)
(#'evilmi-jump-items)))))