Config: extract EMMS and clean up config, add gptel session save with AI-generated filenames
This commit is contained in:
@@ -4,11 +4,15 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; 好像是ivy-posframe里的函数,后面要用
|
||||
(defun childframe-completion-workable-p ()
|
||||
"Check if childframe completion is workable."
|
||||
(and (display-graphic-p)
|
||||
(not (eq system-type 'windows-nt))
|
||||
(>= emacs-major-version 26)))
|
||||
|
||||
(use-package hydra
|
||||
:defines (consult-imenu-config posframe-border-width)
|
||||
:functions childframe-completion-workable-p
|
||||
:hook ((emacs-lisp-mode . hydra-add-imenu)
|
||||
((after-init after-load-theme server-after-make-frame) . hydra-set-posframe))
|
||||
:defines (consult-imenu-config)
|
||||
:init
|
||||
(with-eval-after-load 'consult-imenu
|
||||
(setq consult-imenu-config
|
||||
@@ -18,28 +22,11 @@
|
||||
(?m "Macros" font-lock-function-name-face)
|
||||
(?p "Packages" font-lock-constant-face)
|
||||
(?t "Types" font-lock-type-face)
|
||||
(?v "Variables" font-lock-variable-name-face))))))
|
||||
|
||||
(defun hydra-set-posframe ()
|
||||
"Set display type and appearance of hydra."
|
||||
;; Display type
|
||||
(if (childframe-completion-workable-p)
|
||||
(setq hydra-hint-display-type 'posframe)
|
||||
(setq hydra-hint-display-type 'lv))
|
||||
;; Appearance
|
||||
(setq hydra-posframe-show-params
|
||||
`(:left-fringe 8
|
||||
:right-fringe 8
|
||||
:internal-border-width ,posframe-border-width
|
||||
:internal-border-color ,(face-background 'posframe-border nil t)
|
||||
:background-color ,(face-background 'tooltip nil t)
|
||||
:foreground-color ,(face-foreground 'tooltip nil t)
|
||||
:lines-truncate t
|
||||
:poshandler posframe-poshandler-frame-center-near-bottom))))
|
||||
(?v "Variables" font-lock-variable-name-face)))))))
|
||||
|
||||
;; multiple-cursors
|
||||
(defhydra hydra-multiple-cursors ()
|
||||
"
|
||||
"
|
||||
^Mark^ ^Unmark^ ^Other^
|
||||
------------------------------------------------------------------
|
||||
_p_ : prev line _P_ : previous _c_ : edit lines
|
||||
@@ -49,17 +36,17 @@ _b_ : prev symbol
|
||||
_s_ : in region
|
||||
_a_ : all dwim
|
||||
"
|
||||
("p" mc/mark-previous-like-this)
|
||||
("n" mc/mark-next-like-this)
|
||||
("b" mc/mark-previous-like-this-symbol)
|
||||
("f" mc/mark-next-like-this-symbol)
|
||||
("P" mc/unmark-previous-like-this)
|
||||
("N" mc/unmark-next-like-this)
|
||||
("a" mc/mark-all-dwim)
|
||||
("s" mc/mark-all-in-region)
|
||||
("c" mc/edit-lines)
|
||||
("." mc/mark-pop)
|
||||
("q" nil))
|
||||
("p" mc/mark-previous-like-this)
|
||||
("n" mc/mark-next-like-this)
|
||||
("b" mc/mark-previous-like-this-symbol)
|
||||
("f" mc/mark-next-like-this-symbol)
|
||||
("P" mc/unmark-previous-like-this)
|
||||
("N" mc/unmark-next-like-this)
|
||||
("a" mc/mark-all-dwim)
|
||||
("s" mc/mark-all-in-region)
|
||||
("c" mc/edit-lines)
|
||||
("." mc/mark-pop)
|
||||
("q" nil))
|
||||
|
||||
(global-set-key (kbd "C-c c") 'hydra-multiple-cursors/body)
|
||||
|
||||
@@ -84,7 +71,7 @@ _a_ : all dwim
|
||||
(defun restart-emacs ()
|
||||
"Restart emacs (for Windows)"
|
||||
(interactive)
|
||||
(save-some-buffers)
|
||||
(save-some-buffers)
|
||||
(w32-shell-execute "open" "runemacs.exe")
|
||||
(kill-emacs))
|
||||
(global-set-key (kbd "C-c r") 'restart-emacs))
|
||||
@@ -207,7 +194,7 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
||||
|
||||
;; 使用快速切换到scratch buffer
|
||||
(if *is-mac*
|
||||
(global-set-key (kbd "C-C <f12>") 'scratch-buffer)
|
||||
(global-set-key (kbd "C-c <f12>") 'scratch-buffer)
|
||||
(global-set-key (kbd "C-c <delete>") 'scratch-buffer))
|
||||
|
||||
;; 调整window
|
||||
@@ -310,7 +297,7 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
||||
(fboundp 'w32-shell-execute))
|
||||
(shell-command-to-string (encode-coding-string (replace-regexp-in-string "/" "\\\\"
|
||||
(format "explorer.exe %s" (file-name-directory (expand-file-name file))))
|
||||
'gbk))
|
||||
'gbk))
|
||||
(call-process (pcase system-type
|
||||
('darwin "open")
|
||||
('cygwin "cygstart")
|
||||
@@ -406,17 +393,17 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
||||
(define-key embark-file-map (kbd "p") 'emms-play-dired))
|
||||
|
||||
(add-hook 'dired-mode-hook
|
||||
(lambda ()
|
||||
(local-unset-key (kbd "<mouse-2>"))
|
||||
(local-set-key (kbd "<mouse-2>") 'emms-play-dired)
|
||||
(local-set-key (kbd "C-c m a") 'emms-add-dired)))
|
||||
(lambda ()
|
||||
(local-unset-key (kbd "<mouse-2>"))
|
||||
(local-set-key (kbd "<mouse-2>") 'emms-play-dired)
|
||||
(local-set-key (kbd "C-c m a") 'emms-add-dired)))
|
||||
|
||||
(add-hook 'emms-playlist-mode-hook
|
||||
(lambda ()
|
||||
(local-unset-key (kbd "<prior>"))
|
||||
(local-unset-key (kbd "<next>"))
|
||||
(local-set-key (kbd "<prior>") 'emms-previous)
|
||||
(local-set-key (kbd "<next>") 'emms-next)))
|
||||
(lambda ()
|
||||
(local-unset-key (kbd "<prior>"))
|
||||
(local-unset-key (kbd "<next>"))
|
||||
(local-set-key (kbd "<prior>") 'emms-previous)
|
||||
(local-set-key (kbd "<next>") 'emms-next)))
|
||||
|
||||
(defun switch-to-emms-playlist()
|
||||
"Switch to emms playlist."
|
||||
@@ -452,7 +439,9 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
||||
"o" 'gptel
|
||||
"m" 'gptel-menu
|
||||
"s" 'gptel-send
|
||||
"a" 'gptel-agent)
|
||||
"a" 'gptel-agent
|
||||
"t" 'gptel-tools
|
||||
"g" 'gptel-mode)
|
||||
|
||||
(provide 'init-kbd)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user