(or emacs irrelevant)

ace-window full path

I just closed a really helpful issue for ace-window. Turns out that there's a plugin for vim called Easymotion that's very similar to ace-jump-mode. And that plugin doesn't highlight the leading chars one by one, but instead gives them all at once. Which is a pretty good idea, since it's more convenient to read the whole path at once and type it in at once rather than:

  • read one char
  • type one char
  • read one more char
  • type one more char
  • ... (maybe more steps)

To turn on the new behavior:

(setq aw-leading-char-style 'path)

Although this will only have an effect once you have more than 10 windows. But this method really improves the functions from avy-jump.el. I've added some more commands and renamed the old ones since yesterday.

avy-jump demos

avi-goto-char-2

Here's how I like to bind avi-goto-char-2:

(global-set-key (kbd "C-'") 'avi-goto-char-2)

And here's the result of C-' bu:

avi-goto-char-2

As you can see, nothing is overwritten by the overlay - it's appended after the search chars. In the screenshot above, I have avi-background at nil; you can set it to t if you want a gray background.

avi-goto-char

After binding avi-goto-char:

(global-set-key (kbd "π") 'avi-goto-char)

Here's the result of π b:

avi-goto-char

avi-goto-line

After binding avi-goto-line:

(global-set-key (kbd "M-g f") 'avi-goto-line)

Here's the result of M-g f:

avi-goto-line

I've also added:

  • avi-copy-line
  • avi-move-line
  • avi-copy-region

These functions use the method of avi-goto-line to copy/move stuff. It might be useful for line-based text.

avi-goto-word-0

Here's the simple definition and the binding:

(defun avi-goto-word-0 ()
  "Jump to a word start in current window."
  (interactive)
  (let* ((avi-keys (number-sequence ?a ?z))
         (candidates (avi--regex-candidates "\\b\\sw")))
    (avi--goto
     (avi--process candidates #'avi--overlay-pre))))
(global-set-key (kbd "M-g e") 'avi-goto-word-0)

There might be quite a lot of candidates for this one, but there's no call to read-char. Here's what happens after M-g e:

avi-goto-word-0

avi-goto-word-1

Here's a version of it that reads one char:

(defun avi-goto-word-1 ()
  "Jump to a word start in current window.
Read one char with which the word should start."
  (interactive)
  (let ((candidates (avi--regex-candidates
                     (concat
                      "\\b"
                      (string (read-char "char: "))))))
    (avi--goto
     (avi--process candidates #'avi--overlay-pre))))
(global-set-key (kbd "M-g w") 'avi-goto-word-1)

Here's what happens after M-g w b:

avi-goto-word-1

Outro

Give the new functions a go and see if you like them. New ideas are welcome, especially pertaining to ripping off vim plugins. I did the vimtutor once, but I have no idea how vim plugins work. But it turns out that I like Easymotion.