"
^^^^^^ ^Yes^ ^No^ ^Maybe^ ^Action^
^^^^^^^^^^^^^^---------------------------------------------------
-^ ^ _k_ ^ ^ _f_ollow _i_nsert _c_: calling %s(if ivy-calling \"on\" \"off\") _w_/_s_: %s(ivy-action-name)
+^ ^ _k_ ^ ^ _f_ollow _i_nsert _c_: calling %s(if ivy-calling \"on\" \"off\") _w_/_s_/_a_: %s(ivy-action-name)
_h_ ^+^ _l_ _d_one _o_ops _m_: matcher %s(if (eq ivy--regex-function 'ivy--regex-fuzzy) \"fuzzy\" \"ivy\")
^ ^ _j_ ^ ^ _g_o ^ ^ _<_/_>_: shrink/grow _t_runcate: %`truncate-lines
"
("<" ivy-minibuffer-shrink)
("w" ivy-prev-action)
("s" ivy-next-action)
+ ("a" ivy-read-action)
("t" (setq truncate-lines (not truncate-lines))))
(provide 'ivy-hydra)
(define-key map (kbd "M-i") 'ivy-insert-current)
(define-key map (kbd "C-o") 'hydra-ivy/body)
(define-key map (kbd "M-o") 'ivy-dispatching-done)
+ (define-key map (kbd "C-M-o") 'ivy-dispatching-call)
(define-key map (kbd "C-k") 'ivy-kill-line)
(define-key map (kbd "S-SPC") 'ivy-restrict-to-matches)
(define-key map (kbd "M-w") 'ivy-kill-ring-save)
(insert ivy-text)
(ivy--exhibit))))
-(defun ivy-dispatching-done ()
- "Select one of the available actions and call `ivy-done'."
+(defun ivy-read-action ()
+ "Change the action to one of the available ones."
(interactive)
(let ((actions (ivy-state-action ivy-last)))
- (if (null (ivy--actionp actions))
- (ivy-done)
+ (unless (null (ivy--actionp actions))
(let* ((hint (concat ivy--current
"\n"
(mapconcat
"\n")
"\n"))
(key (string (read-key hint)))
- (action (assoc key (cdr actions))))
+ (action-idx (cl-position-if
+ (lambda (x) (equal (car x) key))
+ (cdr actions))))
(cond ((string= key "\a"))
- ((null action)
+ ((null action-idx)
(error "%s is not bound" key))
(t
(message "")
- (ivy-set-action (nth 1 action))
- (ivy-done)))))))
+ (setcar actions (1+ action-idx))
+ (ivy-set-action actions)))))))
+
+(defun ivy-dispatching-done ()
+ "Select one of the available actions and call `ivy-done'."
+ (interactive)
+ (ivy-read-action)
+ (ivy-done))
+
+(defun ivy-dispatching-call ()
+ "Select one of the available actions and call `ivy-call'."
+ (interactive)
+ (let ((actions (copy-sequence (ivy-state-action ivy-last))))
+ (ivy-read-action)
+ (ivy-call)
+ (ivy-set-action actions)))
(defun ivy-build-tramp-name (x)
"Reconstruct X into a path.