(file (buffer-substring-no-properties start end)))
`(,start ,end completion--file-name-table . (:exclusive no))))))
+ (defun esy/margin-formatter (metadata)
+ "Margin formatter for `corfu-margin-formatters'."
+ (pcase (cdr (assoc 'category metadata))
+ ('file (lambda (string)
+ (concat (if (string-suffix-p "/" string)
+ (all-the-icons-icon-for-dir string)
+ (all-the-icons-icon-for-file string))
+ " ")))
+ ('dabbrev (lambda (_) "… "))))
+
(defun esy/setup-completion-at-point ()
"Setup `completion-at-point'."
(require 'corfu)
- (setq corfu-cycle t)
+ (setq corfu-cycle t
+ corfu-margin-formatters '(esy/margin-formatter))
(global-corfu-mode)
(add-to-list 'completion-at-point-functions #'esy/dabbrev-capf)
(add-to-list 'completion-at-point-functions #'esy/file-capf))