This commit is contained in:
2025-09-25 20:29:24 -06:00
parent 5751914838
commit 91c554d575

View File

@@ -1,80 +1,27 @@
#+title: evil-leap #+title: evil-leap
#+subtitle: Emacs' answer to Neovim's answer to the mouse.
#+author: Madeleine Sydney #+author: Madeleine Sydney
Emacs' answer to Neovim's answer to the mouse Evil-leap is a port of [[https://github.com/ggandor/leap.nvim/][leap.nvim]], a fantastic Neovim package that allows you to search for and quickly jump to two-character strings.
* Tasks * Installation
** DONE Many targets w/ [[kbd:][SPC]] and [[kbd:][DEL]] labels With ~use-package~ + [[https://github.com/radian-software/straight.el][Straight]]:
CLOSED: [2024-11-27 Wed 16:04]
** DONE Passthrough input on fail
CLOSED: [2024-11-23 Sat 09:07]
** DONE Leap backwards
CLOSED: [2024-11-24 Sun 08:55]
** TODO Character equivalence classes
** TODO Match newlines with [[kbd:][SPC SPC]]
** TODO Leap from window
** TODO Only leap to visible targets
Currently, we take care to only search from the point to the beg/end of the window, but we don't account for concealed text, e.g. folded org subtrees.
~evil-snipe~ achieves this by, in their search function, checking if the target is invisible, and skipping the match, if so.
#+begin_src elisp #+begin_src elisp
(defun evil-snipe--seek-re (data scope count) (use-package evil-leap
(let ((regex (mapconcat #'cdr data "")) :straight (:type git
result) :host gitlab
(when (and evil-snipe-skip-leading-whitespace :repo "msyds/evil-leap")
(looking-at-p "[ \t]+") :config
(string-match-p "^[ \t]+" (mapconcat #'car data ""))) ;; Bind `evil-leap-forward' and `evil-leap-backward' here.
(setq regex (concat regex "[^ \t]"))) )
(when (setq result (re-search-forward regex scope t count))
; ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
(if (or (invisible-p (match-beginning 0)) ; ←
(invisible-p (1- (match-end 0)))) ; ←
(evil-snipe--seek-re data scope count) ; ←
; ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
result))))
#+end_src #+end_src
** TODO Avoid leaping to target directly under point * To-do
Currently, if the point is on ~a~, that very ~ab~ pair will be given as a potential target. - [ ] Fix exception thrown when no matches.
- [ ] Fix case-sensitive searching.
#+begin_src - [ ] ~SPC SPC~ to match newline.
- [ ] Remove Evil dependency.
ab - [ ] Case-fold?
#+end_src
** TODO Leap any direction
** TODO Cleanup w/ ~pre-command-hook~
** TODO Extract equivalence classes from =char-fold-table=
** TODO Documentation
*** TODO Clarify terminology
- "Auto-jump" really means "call ~evil-leap-action~ automatically."
- "Jump to target" really means "call ~evil-leap-action~ on target."
*** TODO Comparison with =evil-snipe=
*** TODO Comparison with ~leap.nvim~
** TODO Correctly use =count= prefix argument
** TODO Support input methods
[[https://github.com/emacs-evil/evil/issues/5][Weird.]]
** TODO Leap to sexp/tree-sitter obj?
** TODO There's no reason to depend on Evil