Config: install denote and some extra packages, add plocate support on linux, optimize keybindings

This commit is contained in:
2026-05-09 01:00:46 +08:00
parent 1808941dcb
commit f419304684
9 changed files with 88 additions and 34 deletions

View File

@@ -8,6 +8,9 @@
;; dirvish
(use-package dirvish
:hook
(dired-mode-hook . denote-dired-mode)
:init
(dirvish-override-dired-mode)
@@ -53,7 +56,7 @@
("s" "~/.config/guix/" "System config")
("p" "~/Pictures/" "Pictures")
("d" "~/downloads/" "Downloads")
("v" "~/Video/" "Videos")
("v" "~/视频/" "Videos")
("n" "~/org/my-org-note/" "Notes")
("g" "~/gptel/" "gptel sessions")))
(t nil))))

View File

@@ -14,7 +14,7 @@
(let ((display-buffer-alist
'((".*" . (display-buffer-no-window . nil)))))
(async-shell-command command))))
(defun restart-fcitx5 ()
"Kill and restart fcitx5, to fix random issues in exwm."
(interactive)
@@ -24,6 +24,21 @@
(eshell-command "fcitx5 -d"))
(eshell-command "fcitx5 -d")))
(defun reboot ()
"Execute loginctl reboot command."
(interactive)
(eshell-command "loginctl reboot"))
(defun poweroff ()
"Execute loginctl poweroff command"
(interactive)
(eshell-command "loginctl poweroff"))
(defun suspend ()
"Execute loginctl suspend command"
(interactive)
(eshell-command "loginctl suspend"))
(defun my--exwm-switch-to-workspace (delta)
(let ((target
(mod (+ exwm-workspace-current-index delta)

View File

@@ -66,6 +66,13 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
nil 0 nil
(file-name-directory (expand-file-name file)))))
(defun consult-fd-global ()
"Search for all files use fd"
(interactive)
(let ((consult-fd-args "fd -H -I -i -c never --full-path")
(default-directory "~/"))
(consult-fd)))
(defun my-open-current-directory ()
"Open current directory in default file explorer."
(interactive)

View File

@@ -128,6 +128,11 @@
"M-]" nil
"C-q" 'vterm-send-next-key)
;; eat
(general-def (eat-semi-char-mode-map eat-line-mode-map eat-char-mode-map eat-eshell-semi-char-mode-map eat-eshell-char-mode-map)
"M-[" nil
"M-]" nil)
;; embark
(general-def embark-file-map
"d" 'consult-directory-externally
@@ -145,8 +150,8 @@
(general-def org-mode-map
"C-<tab>" 'org-cycle-parent-subtree
"C-c i" 'consult-outline
"C-c o l" 'org-toggle-link-display
"C-c C-k" 'kmacro-call-macro
"C-c t l" 'org-toggle-link-display
"C-c C-k" 'kmacro-call-macroe
"M-{" 'org-previous-visible-heading
"M-}" 'org-next-visible-heading)
@@ -174,8 +179,10 @@
"a" 'org-agenda
"l" 'org-store-link
"k" 'comment-line
"v" 'vterm
"C-k" 'kmacro-call-macro)
;; "v" 'vterm
"E" 'eshell
"C-k" 'kmacro-call-macro
"C-t" 'trashed)
;; global map
(general-def
@@ -249,20 +256,6 @@
"j o" 'org-journal-open-entry-for-editing
"<RET>" 'org-journal-open-entry-for-editing)
;; hydra
(use-package hydra
:defines (consult-imenu-config)
:init
(with-eval-after-load 'consult-imenu
(setq consult-imenu-config
'((emacs-lisp-mode :toplevel "Functions"
:types ((?f "Functions" font-lock-function-name-face)
(?h "Hydras" font-lock-constant-face)
(?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)))))))
;; multiple-cursors
(defhydra hydra-multiple-cursors ()
"

View File

@@ -74,6 +74,29 @@
'org-babel-load-languages
org-babel-load-languages))
;; denote
(use-package denote
:config
(setq denote-directory "~/org/my-org-note/")
(setq denote-prompts '(title signature keywords))
(setq denote-title-history nil)
(setq denote-known-keywords
'("emacs" "org" "elisp" "scheme" "programming" "philosophy" "film" "linux" "computerstuff" "game" "masterpiece")))
;; denote-org
(use-package denote-org)
;; denote-explore
(use-package denote-explore)
;; consult-notes
(use-package consult-notes
:init
(consult-notes-denote-mode)
:config
(setq consult-notes-file-dir-sources '(("Org Notes" ?n "~/org/my-org-note/" :hidden t)
("Org Journal" ?j "~/org/my-org-daily/" :hidden t))))
;; org-download
(use-package org-download
:config

View File

@@ -57,13 +57,6 @@
(use-package consult
:config
(defun consult-fd-global ()
"Search for all files use fd"
(interactive)
(let ((consult-fd-args "fd -H -I -i -c never --full-path")
(default-directory "~/"))
(consult-fd)))
;; everything
(when *is-windows*
(setq consult-locate-args (encode-coding-string "es.exe -i -p -r" 'gbk))
@@ -74,12 +67,11 @@
;; mdfind
(when *is-mac*
(setopt consult-locate-args "mdfind -name")))
(setq consult-locate-args "mdfind -name"))
(use-package consult-notes
:config
(setq consult-notes-file-dir-sources '(("Org Notes" ?n "~/org/my-org-note/")
("Org Journal" ?j "~/org/my-org-daily/" :hidden t))))
;; plocate
(when *is-linux*
(setq consult-locate-args "plocate --basename --ignore-case")))
;; embark
(use-package embark
@@ -234,8 +226,8 @@ targets."
(use-package consult-flycheck)
;; vterm
(unless *is-windows*
(use-package vterm))
;; (unless *is-windows*
;; (use-package vterm))
;; eat
(use-package eat
@@ -257,6 +249,20 @@ targets."
;; general
(use-package general)
;; hydra
(use-package hydra
:defines (consult-imenu-config)
:init
(with-eval-after-load 'consult-imenu
(setq consult-imenu-config
'((emacs-lisp-mode :toplevel "Functions"
:types ((?f "Functions" font-lock-function-name-face)
(?h "Hydras" font-lock-constant-face)
(?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)))))))
;; perspective
(use-package perspective
:bind

View File

@@ -94,6 +94,9 @@
(setq use-short-answers t)
(fset 'yes-or-no-p 'y-or-n-p))
;; 移动到垃圾桶
(setq delete-by-moving-to-trash t)
(provide 'init-startup)
;;; init-startup.el ends here

View File

@@ -41,6 +41,8 @@
`(dashboard-heading ((,class (:foreground ,green :weight bold))))
`(dirvish-file-time ((,class (:foreground ,base01))))
`(dired-header ((,class (:foreground ,green))))
`(consult-file ((,class (:foreground ,green))))
`(denote-faces-keywords ((,class (:foreground ,cyan))))
`(mode-line ((,class (:foreground ,base0 :background ,base02))))
`(mode-line-inactive ((,class (:foreground ,base01 :background ,base03))))
`(display-time-date-and-time ((,class (:foreground ,base1 :bold t))))

View File

@@ -41,6 +41,8 @@
`(dashboard-heading ((,class (:foreground ,green :weight bold))))
`(dirvish-file-time ((,class (:foreground ,base01))))
`(dired-header ((,class (:foreground ,green))))
`(consult-file ((,class (:foreground ,green))))
`(denote-faces-keywords ((,class (:foreground ,cyan))))
`(mode-line ((,class (:foreground ,base0 :background ,base02))))
`(mode-line-inactive ((,class (:foreground ,base01 :background ,base03))))
`(display-time-date-and-time ((,class (:foreground ,base1 :bold t))))