branch: master commit d609eb98bd4f4c380eb5a6dcfa0399d6a9ef9325 Author: Peter Nguyen <pe...@mictis.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
Add avy-goto-word-0-below and avy-goto-word-0-above These commands limit the scope of avy-goto-word-0 to above or below the point thus save the number of keys required to jump to a certain word Fixes #186 --- avy.el | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/avy.el b/avy.el index 6cfedca..bd96bf6 100644 --- a/avy.el +++ b/avy.el @@ -1050,12 +1050,24 @@ the visible part of the current buffer following point." (isearch-done)))) ;;;###autoload -(defun avy-goto-word-0 (arg) +(defun avy-goto-word-0 (arg &optional beg end) "Jump to a word start. The window scope is determined by `avy-all-windows' (ARG negates it)." (interactive "P") (avy-with avy-goto-word-0 - (avy--generic-jump avy-goto-word-0-regexp arg avy-style))) + (avy--generic-jump avy-goto-word-0-regexp arg avy-style beg end))) + +(defun avy-goto-word-0-above (arg) + "Jump to a word start between window start and point." + (interactive "P") + (avy-with avy-goto-word-0 + (avy-goto-word-0 arg (window-start) (point)))) + +(defun avy-goto-word-0-below (arg) + "Jump to a word start between point and window end." + (interactive "P") + (avy-with avy-goto-word-0 + (avy-goto-word-0 arg (point) (window-end (selected-window) t)))) ;;;###autoload (defun avy-goto-word-1 (char &optional arg beg end symbol)