evil-leap

Emacs' answer to [[id:eaeb7646-cb93-4674-8f2b-b58f7d43b0cc][Neovim's answer to the mouse]].

evil-leap is a port of leap.nvim to Emacs.

Tasks

Small code quality pass

Suggestions by @carcius from the Doom server. Thanks! }:D

Fix dependency usage

  • You can use eval-and-compile instead of requiring evil twice.

  • You can eval-when-compile cl-lib.

  • You are using Dash.el (-some->, -cycle), but you don't require it anywhere.

Remove Dash and ht

Many targets w/ SPC and DEL labels

Passthrough input on fail

Leap backwards

Character equivalence classes

Match newlines with SPC SPC

Leap from window

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.

(defun evil-snipe--seek-re (data scope count)
  (let ((regex (mapconcat #'cdr data ""))
        result)
    (when (and evil-snipe-skip-leading-whitespace
               (looking-at-p "[ \t]+")
               (string-match-p "^[ \t]+" (mapconcat #'car data "")))
      (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))))

Avoid leaping to target directly under point

Currently, if the point is on a, that very ab pair will be given as a potential target.

↓
ab

Leap any direction

Cleanup w/ pre-command-hook

Extract equivalence classes from char-fold-table

Documentation

Clarify terminology

  • "Auto-jump" really means "call evil-leap-action automatically."

  • "Jump to target" really means "call evil-leap-action on target."

Comparison with evil-snipe

Comparison with leap.nvim

Correctly use count prefix argument

Support input methods

Weird.

Leap to sexp/tree-sitter obj?

There's no reason to depend on Evil