'((t :inherit font-lock-builtin-face))
"Face used by Ivy for matching virtual buffer names.")
+(defface ivy-action
+ '((t :inherit font-lock-builtin-face))
+ "Face used by Ivy for displaying keys in `ivy-read-action'.")
+
(setcdr (assoc load-file-name custom-current-group-alist) 'ivy)
(defcustom ivy-height 10
(define-key map (kbd "C-s") 'ivy-next-line-or-history)
(define-key map (kbd "C-r") 'ivy-reverse-i-search)
(define-key map (kbd "SPC") 'self-insert-command)
- (define-key map (kbd "DEL") 'ivy-backward-delete-char)
+ (define-key map [remap delete-backward-char] 'ivy-backward-delete-char)
(define-key map [remap backward-kill-word] 'ivy-backward-kill-word)
(define-key map [remap delete-char] 'ivy-delete-char)
(define-key map [remap forward-char] 'ivy-forward-char)
(insert ivy-text)
(ivy--exhibit))))
+(defvar ivy-read-action-format-function 'ivy-read-action-format-default
+ "Function used to transform the actions list into a docstring.")
+
+(defun ivy-read-action-format-default (actions)
+ "Create a docstring from ACTIONS.
+
+ACTIONS is a list. Each list item is a list of 3 items:
+key (a string), cmd and doc (a string)."
+ (format "%s\n%s\n"
+ (if (eq this-command 'ivy-read-action)
+ "Select action: "
+ ivy--current)
+ (mapconcat
+ (lambda (x)
+ (format "%s: %s"
+ (propertize
+ (car x)
+ 'face 'ivy-action)
+ (nth 2 x)))
+ actions
+ "\n")))
+
(defun ivy-read-action ()
"Change the action to one of the available ones.
(let ((actions (ivy-state-action ivy-last)))
(if (null (ivy--actionp actions))
t
- (let* ((hint (concat (if (eq this-command 'ivy-read-action)
- "Select action: "
- ivy--current)
- "\n"
- (mapconcat
- (lambda (x)
- (format "%s: %s"
- (propertize
- (car x)
- 'face 'font-lock-builtin-face)
- (nth 2 x)))
- (cdr actions)
- "\n")
- "\n"))
+ (let* ((hint (funcall ivy-read-action-format-function (cdr actions)))
(resize-mini-windows 'grow-only)
(key (string (read-key hint)))
(action-idx (cl-position-if