Skip to content

Instantly share code, notes, and snippets.

@hlissner
Last active September 20, 2018 07:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hlissner/4960fe3732c41e48d112 to your computer and use it in GitHub Desktop.
Save hlissner/4960fe3732c41e48d112 to your computer and use it in GitHub Desktop.
Make ace-jump do a two-char search (like vim-sneak)
;; Thanks to: https://github.com/winterTTr/ace-jump-mode/issues/23
(defun ace-jump-two-chars-mode (&optional query-char query-char-2)
"AceJump two chars mode"
(interactive)
(evil-half-cursor)
(setq query-char (or query-char (read-char ">")))
(setq query-char-2 (or query-char-2 (read-char (concat ">" (string query-char)))))
(if (eq (ace-jump-char-category query-char) 'other)
(error "[AceJump] Non-printable character"))
;; others : digit , alpha, punc
(setq ace-jump-query-char query-char)
(setq ace-jump-current-mode 'ace-jump-char-mode)
(ace-jump-do (regexp-quote (concat (char-to-string query-char)
(char-to-string query-char-2)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment