refactor(kbd): Replace my-color-picker with consult-colors-emacs

This commit is contained in:
User
2026-07-02 17:06:29 +08:00
parent 74691ac72b
commit 3aa98696cf
5 changed files with 16 additions and 15 deletions

View File

@@ -68,7 +68,6 @@
search-ring
regexp-search-ring
extended-command-history)
savehist-ignored-variables '(consult-notes-history)
savehist-autosave-interval 300))
;; saveplace保存光标位置

View File

@@ -35,6 +35,9 @@
(*is-linux*
(setq consult-locate-args "plocate --basename --ignore-case")))
(define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help)
(setq consult-narrow-key "<")
;; set some buffer filter
(setq consult-buffer-filter
(cl-union consult-buffer-filter

View File

@@ -257,18 +257,18 @@ argument)."
(when-let* ((proj (project-current t)))
(consult-ripgrep (project-root proj))))
(defun my-color-picker ()
"Pick a color with preview."
(interactive)
(let* ((colors (defined-colors))
(choice (completing-read
"Color: "
(mapcar (lambda (c)
(propertize
(format "%-20s %s" c "████")
'face `(:foreground ,c)))
colors))))
(string-trim (car (split-string choice)))))
(defun consult-colors-emacs (color)
"Show a list of all supported colors for a particular frame.
You can insert the name (default), or insert or kill the hexadecimal or RGB
value of the selected COLOR."
(interactive
(list (consult--read (list-colors-duplicates (defined-colors))
:prompt "Emacs color: "
:require-match t
:category 'color
:history '(:input consult-colors-history))))
(insert color))
(defun fix-theme-colors ()
"Fix invalid color name in theme files."

View File

@@ -37,7 +37,7 @@
"R" 'rainbow-mode
"b" 'indent-bars-mode
"t" 'consult-theme
"c" 'my-color-picker
"c" 'consult-colors-emacs
"f" 'describe-face
"r" 'rainbow-delimiters-mode
"k" 'keycast-header-line-mode

View File

@@ -41,7 +41,6 @@
search-ring
regexp-search-ring
extended-command-history)
savehist-ignored-variables '(consult-notes-history)
savehist-autosave-interval 300))
(use-package saveplace