Config: streamline config structure and reorganize modules
- Remove init-workspace.el and redundant UI/font/autothemer setup - Add init-prog.el for programming language configs (treesit, lua, scheme, etc.) - Defer org-refile loading via org-mode hook - Adjust load order in init.el, add init-proxy - Fix indentation and formatting issues
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -7,4 +7,6 @@
|
|||||||
!lisp/**/
|
!lisp/**/
|
||||||
!lisp/**/*.el
|
!lisp/**/*.el
|
||||||
|
|
||||||
|
lisp/init-proxy.el
|
||||||
|
|
||||||
!.gitignore
|
!.gitignore
|
||||||
|
|||||||
4
init.el
4
init.el
@@ -16,18 +16,18 @@
|
|||||||
(global-display-line-numbers-mode t)
|
(global-display-line-numbers-mode t)
|
||||||
|
|
||||||
(require 'init-const)
|
(require 'init-const)
|
||||||
|
(load "init-proxy" t)
|
||||||
(require 'init-startup)
|
(require 'init-startup)
|
||||||
(require 'init-elpa)
|
(require 'init-elpa)
|
||||||
(require 'init-package)
|
(require 'init-package)
|
||||||
(require 'init-emms)
|
(require 'init-emms)
|
||||||
(require 'init-org)
|
(require 'init-org)
|
||||||
(require 'init-org-refile)
|
(require 'init-prog)
|
||||||
(require 'init-completion)
|
(require 'init-completion)
|
||||||
(require 'init-window)
|
(require 'init-window)
|
||||||
(require 'init-exwm)
|
(require 'init-exwm)
|
||||||
(require 'init-dired)
|
(require 'init-dired)
|
||||||
(require 'init-gptel)
|
(require 'init-gptel)
|
||||||
(require 'init-workspace)
|
|
||||||
(require 'init-ui)
|
(require 'init-ui)
|
||||||
(require 'init-kbd-func)
|
(require 'init-kbd-func)
|
||||||
(require 'init-kbd)
|
(require 'init-kbd)
|
||||||
|
|||||||
@@ -107,31 +107,6 @@
|
|||||||
(advice-add 'eglot-completion-at-point :around #'cape-wrap-nonexclusive)
|
(advice-add 'eglot-completion-at-point :around #'cape-wrap-nonexclusive)
|
||||||
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-nonexclusive))
|
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-nonexclusive))
|
||||||
|
|
||||||
;; tree-sitter
|
|
||||||
(use-package treesit-auto
|
|
||||||
:demand t
|
|
||||||
:config
|
|
||||||
(setq treesit-auto-install 'prompt)
|
|
||||||
(global-treesit-auto-mode)
|
|
||||||
(setq treesit-font-lock-level 4))
|
|
||||||
|
|
||||||
;; lua
|
|
||||||
(use-package lua-ts-mode
|
|
||||||
:mode ("\\.lua\\'" . lua-ts-mode)
|
|
||||||
:config
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-ts-mode)))
|
|
||||||
|
|
||||||
;; ahk
|
|
||||||
(use-package ahk-mode)
|
|
||||||
|
|
||||||
;; scheme
|
|
||||||
(use-package geiser
|
|
||||||
:config
|
|
||||||
(with-eval-after-load 'geiser
|
|
||||||
(setq geiser-default-implementation 'guile)))
|
|
||||||
|
|
||||||
(use-package geiser-guile)
|
|
||||||
|
|
||||||
(provide 'init-completion)
|
(provide 'init-completion)
|
||||||
|
|
||||||
;;; init-completion.el ends here
|
;;; init-completion.el ends here
|
||||||
|
|||||||
@@ -11,24 +11,12 @@
|
|||||||
(setq dashboard-banner-logo-title (format "%s" emacs-version))
|
(setq dashboard-banner-logo-title (format "%s" emacs-version))
|
||||||
(setq dashboard-banner-ascii " ##### # # # # ####### # # # ##### ##### \n# # ## # # # # ## ## # # # # # # \n# # # # # # # # # # # # # # # \n# #### # # # # # ##### # # # # # # ##### \n# # # # # # # # # # ####### # # \n# # # ## # # # # # # # # # # # \n ##### # # ##### ####### # # # # ##### ##### ")
|
(setq dashboard-banner-ascii " ##### # # # # ####### # # # ##### ##### \n# # ## # # # # ## ## # # # # # # \n# # # # # # # # # # # # # # # \n# #### # # # # # ##### # # # # # # ##### \n# # # # # # # # # # ####### # # \n# # # ## # # # # # # # # # # # \n ##### # # ##### ####### # # # # ##### ##### ")
|
||||||
(setq dashboard-startup-banner 'ascii)
|
(setq dashboard-startup-banner 'ascii)
|
||||||
|
(setq dashboard-footer-messages '("hello"))
|
||||||
(setq dashboard-center-content t)
|
(setq dashboard-center-content t)
|
||||||
(setq dashboard-navigation-cycle t)
|
(setq dashboard-navigation-cycle t)
|
||||||
(setq dashboard-items '((recents . 15)
|
(setq dashboard-items '((recents . 15)
|
||||||
(bookmarks . 5)
|
(bookmarks . 5)
|
||||||
(projects . 5)))
|
(projects . 5)))
|
||||||
(add-hook 'emacs-startup-hook
|
|
||||||
(lambda()
|
|
||||||
(setq my-emacs-startup-time (format-time-string "%Y-%m-%d %H:%M:%S"))))
|
|
||||||
(defun my/dashboard-insert-copyright ()
|
|
||||||
"Insert copyright in the footer."
|
|
||||||
(dashboard-insert-center
|
|
||||||
(propertize (format "\n\nEmacs started at %s" my-emacs-startup-time)
|
|
||||||
'face 'font-lock-comment-face)))
|
|
||||||
(advice-add #'dashboard-insert-footer :after #'my/dashboard-insert-copyright)
|
|
||||||
(setq dashboard-footer-messages '(
|
|
||||||
"Hello."
|
|
||||||
"Hi."
|
|
||||||
))
|
|
||||||
(setq dashboard-item-shortcuts '((recents . "r") (bookmarks . "b") (projects . "p") (agenda . "a") (registers . "e"))))
|
(setq dashboard-item-shortcuts '((recents . "r") (bookmarks . "b") (projects . "p") (agenda . "a") (registers . "e"))))
|
||||||
|
|
||||||
(provide 'init-dashboard)
|
(provide 'init-dashboard)
|
||||||
|
|||||||
@@ -4,27 +4,6 @@
|
|||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
;; Clash 代理配置
|
|
||||||
;; (if *is-linux*
|
|
||||||
;; (progn
|
|
||||||
;; (setq url-proxy-services
|
|
||||||
;; '(("http" . "192.168.31.121:7890")
|
|
||||||
;; ("https" . "192.168.31.121:7890")
|
|
||||||
;; ("no_proxy" . "\\(localhost\\|127\\.0\\.0\\.1\\|192\\.168\\.*\\)")))
|
|
||||||
|
|
||||||
;; (setenv "http_proxy" "192.168.31.121:7890")
|
|
||||||
;; (setenv "https_proxy" "192.168.31.121:7890"))
|
|
||||||
|
|
||||||
(progn
|
|
||||||
(setq url-proxy-services
|
|
||||||
'(("http" . "127.0.0.1:7890")
|
|
||||||
("https" . "127.0.0.1:7890")
|
|
||||||
("no_proxy" . "\\(localhost\\|127\\.0\\.0\\.1\\|192\\.168\\.*\\)")))
|
|
||||||
|
|
||||||
(setenv "http_proxy" "127.0.0.1:7890")
|
|
||||||
(setenv "https_proxy" "127.0.0.1:7890"))
|
|
||||||
;; )
|
|
||||||
|
|
||||||
;; straight.el
|
;; straight.el
|
||||||
(defvar bootstrap-version)
|
(defvar bootstrap-version)
|
||||||
(let ((bootstrap-file
|
(let ((bootstrap-file
|
||||||
@@ -61,8 +40,8 @@
|
|||||||
|
|
||||||
;; 安装benchmark-init
|
;; 安装benchmark-init
|
||||||
(use-package benchmark-init
|
(use-package benchmark-init
|
||||||
:init (benchmark-init/activate)
|
:init (benchmark-init/activate)
|
||||||
:hook (after-init . benchmark-init/deactivate))
|
:hook (after-init . benchmark-init/deactivate))
|
||||||
|
|
||||||
(provide 'init-elpa)
|
(provide 'init-elpa)
|
||||||
|
|
||||||
|
|||||||
@@ -21,40 +21,7 @@
|
|||||||
(add-hook 'gptel-post-response-functions 'gptel-end-of-response)
|
(add-hook 'gptel-post-response-functions 'gptel-end-of-response)
|
||||||
(add-hook 'gptel-post-stream-hook 'gptel-auto-scroll)
|
(add-hook 'gptel-post-stream-hook 'gptel-auto-scroll)
|
||||||
|
|
||||||
(setq gptel-prompt-prefix-alist '((markdown-mode . "### ") (org-mode . "** User: ") (text-mode . "### ")))
|
(setq gptel-prompt-prefix-alist '((markdown-mode . "## User: ") (org-mode . "** User: ") (text-mode . "## User: ")))
|
||||||
|
|
||||||
;; 读取文件
|
|
||||||
(gptel-make-tool
|
|
||||||
:function (lambda (filepath)
|
|
||||||
(with-temp-buffer
|
|
||||||
(insert-file-contents (expand-file-name filepath))
|
|
||||||
(buffer-string)))
|
|
||||||
:name "read_file"
|
|
||||||
:description "Read and display the contents of a file"
|
|
||||||
:args '((:name "filepath" :type string :description "Path to the file"))
|
|
||||||
:category "filesystem")
|
|
||||||
|
|
||||||
;; 创建文件
|
|
||||||
(gptel-make-tool
|
|
||||||
:name "create_file" ; javascript-style snake_case name
|
|
||||||
:function (lambda (path filename content) ; the function that runs
|
|
||||||
(let ((full-path (expand-file-name filename path)))
|
|
||||||
(with-temp-buffer
|
|
||||||
(insert content)
|
|
||||||
(write-file full-path))
|
|
||||||
(format "Created file %s in %s" filename path)))
|
|
||||||
:description "Create a new file with the specified content"
|
|
||||||
:args (list '(:name "path" ; a list of argument specifications
|
|
||||||
:type string
|
|
||||||
:description "The directory where to create the file")
|
|
||||||
'(:name "filename"
|
|
||||||
:type string
|
|
||||||
:description "The name of the file to create")
|
|
||||||
'(:name "content"
|
|
||||||
:type string
|
|
||||||
:description "The content to write to the file"))
|
|
||||||
:category "filesystem") ; An arbitrary label for grouping
|
|
||||||
|
|
||||||
|
|
||||||
(gptel-make-tool
|
(gptel-make-tool
|
||||||
:name "read_buffer" ; javascript-style snake_case name
|
:name "read_buffer" ; javascript-style snake_case name
|
||||||
@@ -110,41 +77,41 @@ from the last 1500 characters of the buffer."
|
|||||||
tail)))
|
tail)))
|
||||||
(message "Generating filename with AI...")
|
(message "Generating filename with AI...")
|
||||||
(let ((fsm (gptel-request prompt-text
|
(let ((fsm (gptel-request prompt-text
|
||||||
:system "You are a filename generator. Output ONLY a short kebab-case filename (3-5 lowercase English words separated by hyphens). No explanations, no quotes, no punctuation, no file extension."
|
:system "You are a filename generator. Output ONLY a short kebab-case filename (3-5 lowercase English words separated by hyphens). No explanations, no quotes, no punctuation, no file extension."
|
||||||
:stream nil
|
:stream nil
|
||||||
:callback
|
:callback
|
||||||
(lambda (response info)
|
(lambda (response info)
|
||||||
(condition-case err
|
(condition-case err
|
||||||
(cond
|
(cond
|
||||||
((null response)
|
((null response)
|
||||||
(message "Failed to generate filename: %s"
|
(message "Failed to generate filename: %s"
|
||||||
(or (plist-get info :status) "unknown error")))
|
(or (plist-get info :status) "unknown error")))
|
||||||
((not (stringp response))
|
((not (stringp response))
|
||||||
(message "Unexpected response type: %S" response))
|
(message "Unexpected response type: %S" response))
|
||||||
(t
|
(t
|
||||||
(let* ((generated (my-gptel--sanitize-filename (string-trim response)))
|
(let* ((generated (my-gptel--sanitize-filename (string-trim response)))
|
||||||
(generated (if (string-empty-p generated)
|
(generated (if (string-empty-p generated)
|
||||||
"gptel-session"
|
"gptel-session"
|
||||||
generated))
|
generated))
|
||||||
(timestamp (format-time-string "%Y%m%d-%H%M%S"))
|
(timestamp (format-time-string "%Y%m%d-%H%M%S"))
|
||||||
(dir (expand-file-name "~/gptel/"))
|
(dir (expand-file-name "~/gptel/"))
|
||||||
(base (concat timestamp "-" generated))
|
(base (concat timestamp "-" generated))
|
||||||
(file (expand-file-name (concat base ".org") dir)))
|
(file (expand-file-name (concat base ".org") dir)))
|
||||||
;; handle name collision
|
;; handle name collision
|
||||||
(when (file-exists-p file)
|
(when (file-exists-p file)
|
||||||
(setq base (concat timestamp "-" generated "-" (format-time-string "%S")))
|
(setq base (concat timestamp "-" generated "-" (format-time-string "%S")))
|
||||||
(setq file (expand-file-name (concat base ".org") dir)))
|
(setq file (expand-file-name (concat base ".org") dir)))
|
||||||
(unless (file-directory-p dir)
|
(unless (file-directory-p dir)
|
||||||
(make-directory dir t))
|
(make-directory dir t))
|
||||||
;; write-file triggers gptel--save-state to preserve metadata
|
;; write-file triggers gptel--save-state to preserve metadata
|
||||||
(with-current-buffer buf
|
(with-current-buffer buf
|
||||||
(write-file file))
|
(write-file file))
|
||||||
(if (file-exists-p file)
|
(if (file-exists-p file)
|
||||||
(progn
|
(progn
|
||||||
(pop-to-buffer (find-file-noselect file))
|
(pop-to-buffer (find-file-noselect file))
|
||||||
(message "Saved gptel session to %s" file))
|
(message "Saved gptel session to %s" file))
|
||||||
(message "ERROR: File was not created: %s" file)))))
|
(message "ERROR: File was not created: %s" file)))))
|
||||||
(error (message "gptel save-session error: %S" err)))))))
|
(error (message "gptel save-session error: %S" err)))))))
|
||||||
(unless (plist-get (gptel-fsm-info fsm) :callback)
|
(unless (plist-get (gptel-fsm-info fsm) :callback)
|
||||||
(message "WARNING: gptel-request did not register callback!")))))
|
(message "WARNING: gptel-request did not register callback!")))))
|
||||||
|
|
||||||
|
|||||||
159
lisp/init-org.el
159
lisp/init-org.el
@@ -6,6 +6,71 @@
|
|||||||
|
|
||||||
(use-package org)
|
(use-package org)
|
||||||
|
|
||||||
|
;; 一些随org-mode加载的基础配置
|
||||||
|
(add-hook 'org-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(require 'org-tempo)
|
||||||
|
(require 'init-org-refile)
|
||||||
|
(org-indent-mode)
|
||||||
|
(visual-line-mode)
|
||||||
|
(setq-local electric-pair-inhibit-predicate
|
||||||
|
(lambda (char)
|
||||||
|
(or (eq char ?<)
|
||||||
|
(electric-pair-default-inhibit char))))))
|
||||||
|
|
||||||
|
;; 预加载,防止windows的org-mode加载卡顿
|
||||||
|
(if *is-windows*
|
||||||
|
(progn (run-with-idle-timer
|
||||||
|
0.5 nil
|
||||||
|
(lambda ()
|
||||||
|
(with-temp-buffer
|
||||||
|
(org-mode)
|
||||||
|
(org-mode))
|
||||||
|
(message "Org preloaded")))))
|
||||||
|
|
||||||
|
;; 设置标题字体大小
|
||||||
|
;; (dolist (face org-level-faces)
|
||||||
|
;; (set-face-attribute face nil :height 1))
|
||||||
|
|
||||||
|
;; log默认放入drawer中
|
||||||
|
(setq org-log-done t)
|
||||||
|
(setq org-log-into-drawer t)
|
||||||
|
|
||||||
|
;; 将系统时间(星期)设为英文,防止中文乱码
|
||||||
|
(setq system-time-locale "C")
|
||||||
|
|
||||||
|
;; 设置todo关键字
|
||||||
|
(setq org-todo-keywords
|
||||||
|
(quote ((sequence "TODO(t)" "STARTED(s)" "|" "DONE(d!/!)")
|
||||||
|
(sequence "WAITING(w@/!)" "SOMEDAY(S)" "|" "CANCELLED(c@/!)" "MEETING(m)" "PHONE(p)"))))
|
||||||
|
|
||||||
|
;; agenda相关
|
||||||
|
(cond
|
||||||
|
(*is-windows*
|
||||||
|
(setq org-agenda-files '("h:/emacs/hugo/this-is-my-blog/all-blog.org"
|
||||||
|
"h:/emacs/my-org-daily/"
|
||||||
|
"h:/emacs/my-org-note/")))
|
||||||
|
(*is-mac*
|
||||||
|
(setq org-agenda-files '("~/org/my-org-daily"
|
||||||
|
"~/org/my-org-note/")))
|
||||||
|
(*is-linux*
|
||||||
|
(setq org-agenda-files '("~/org/my-org-daily/"
|
||||||
|
"~/org/my-org-note/"))))
|
||||||
|
|
||||||
|
(setq org-agenda-span 'day)
|
||||||
|
(setq org-default-priority ?C)
|
||||||
|
(setq org-agenda-skip-function-global
|
||||||
|
'(org-agenda-skip-entry-if 'todo '("COMMENT")))
|
||||||
|
|
||||||
|
|
||||||
|
;; 批量调整表格
|
||||||
|
(defun org-table-align-all ()
|
||||||
|
"Ajust all table in current buffer."
|
||||||
|
(interactive)
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(org-table-map-tables 'org-table-align t)))
|
||||||
|
|
||||||
;; org-babel scheme
|
;; org-babel scheme
|
||||||
(use-package ob-scheme
|
(use-package ob-scheme
|
||||||
:straight (:type built-in)
|
:straight (:type built-in)
|
||||||
@@ -18,11 +83,11 @@
|
|||||||
;; org-contrib 和 org-checklist
|
;; org-contrib 和 org-checklist
|
||||||
(use-package org-contrib
|
(use-package org-contrib
|
||||||
:straight (org-contrib :type git :host github :repo "emacsmirror/org-contrib"
|
:straight (org-contrib :type git :host github :repo "emacsmirror/org-contrib"
|
||||||
:depth 1))
|
:depth 1)
|
||||||
|
:config
|
||||||
(add-hook 'org-mode-hook
|
(add-hook 'org-mode-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(require 'org-checklist nil t)))
|
(require 'org-checklist nil t))))
|
||||||
|
|
||||||
;; org-download
|
;; org-download
|
||||||
(use-package org-download
|
(use-package org-download
|
||||||
@@ -36,7 +101,10 @@
|
|||||||
(setq org-download-dragndrop t)
|
(setq org-download-dragndrop t)
|
||||||
(setq org-image-actual-width nil)
|
(setq org-image-actual-width nil)
|
||||||
(setq org-download-image-html-width 600)
|
(setq org-download-image-html-width 600)
|
||||||
(add-hook 'org-mode-hook 'org-display-inline-images)))
|
(add-hook 'org-mode-hook 'org-display-inline-images))
|
||||||
|
(with-eval-after-load 'org
|
||||||
|
(require 'org-download)
|
||||||
|
(setq org-return-follows-link t)))
|
||||||
|
|
||||||
;; org-journal
|
;; org-journal
|
||||||
(use-package org-journal
|
(use-package org-journal
|
||||||
@@ -111,72 +179,12 @@
|
|||||||
(reverse entries))))
|
(reverse entries))))
|
||||||
(save-buffer)))
|
(save-buffer)))
|
||||||
|
|
||||||
(setq org-journal-handle-old-carryover-fn #'my/org-journal-mark-old-todos-as-comment))
|
(setq org-journal-handle-old-carryover-fn #'my/org-journal-mark-old-todos-as-comment)
|
||||||
|
|
||||||
;; 在org-journal加载cns-mode
|
;; 在org-journal加载cns-mode
|
||||||
(add-hook 'org-journal-mode-hook
|
(add-hook 'org-journal-mode-hook
|
||||||
(lambda ()
|
|
||||||
(global-cns-mode-enable-in-buffer)))
|
|
||||||
|
|
||||||
;; 一些随org-mode加载的基础配置
|
|
||||||
(add-hook 'org-mode-hook
|
|
||||||
(lambda ()
|
|
||||||
(require 'org-tempo)
|
|
||||||
(org-indent-mode)
|
|
||||||
(setq-local electric-pair-inhibit-predicate
|
|
||||||
(lambda (char)
|
|
||||||
(or (eq char ?<)
|
|
||||||
(electric-pair-default-inhibit char))))))
|
|
||||||
|
|
||||||
(with-eval-after-load 'org
|
|
||||||
(require 'org-download)
|
|
||||||
(setq org-return-follows-link t))
|
|
||||||
|
|
||||||
;; 预加载,防止windows的org-mode加载卡顿
|
|
||||||
(if *is-windows*
|
|
||||||
(progn (run-with-idle-timer
|
|
||||||
0.5 nil
|
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(with-temp-buffer
|
(global-cns-mode-enable-in-buffer))))
|
||||||
(org-mode)
|
|
||||||
(org-mode))
|
|
||||||
(message "Org preloaded")))))
|
|
||||||
|
|
||||||
;; 设置标题字体大小
|
|
||||||
;; (dolist (face org-level-faces)
|
|
||||||
;; (set-face-attribute face nil :height 1))
|
|
||||||
|
|
||||||
;; log默认放入drawer中
|
|
||||||
(setq org-log-done t)
|
|
||||||
(setq org-log-into-drawer t)
|
|
||||||
|
|
||||||
;; 将系统时间(星期)设为英文,防止中文乱码
|
|
||||||
(setq system-time-locale "C")
|
|
||||||
|
|
||||||
;; 设置todo关键字
|
|
||||||
(setq org-todo-keywords
|
|
||||||
(quote ((sequence "TODO(t)" "STARTED(s)" "|" "DONE(d!/!)")
|
|
||||||
(sequence "WAITING(w@/!)" "SOMEDAY(S)" "|" "CANCELLED(c@/!)" "MEETING(m)" "PHONE(p)"))))
|
|
||||||
|
|
||||||
;; agenda相关
|
|
||||||
(when *is-windows*
|
|
||||||
(setq org-agenda-files '("h:/emacs/hugo/this-is-my-blog/all-blog.org"
|
|
||||||
"h:/emacs/my-org-daily/"
|
|
||||||
"h:/emacs/my-org-note/")))
|
|
||||||
(when *is-mac*
|
|
||||||
(setq org-agenda-files '("~/org/my-org-daily"
|
|
||||||
"~/org/my-org-note/")))
|
|
||||||
|
|
||||||
(when *is-linux*
|
|
||||||
(setq org-agenda-files '("~/org/my-org-daily/"
|
|
||||||
"~/org/my-org-note/")))
|
|
||||||
|
|
||||||
(setq org-agenda-span 'day)
|
|
||||||
|
|
||||||
(setq org-default-priority ?C)
|
|
||||||
|
|
||||||
(setq org-agenda-skip-function-global
|
|
||||||
'(org-agenda-skip-entry-if 'todo '("COMMENT")))
|
|
||||||
|
|
||||||
;; org-ql
|
;; org-ql
|
||||||
(use-package org-ql
|
(use-package org-ql
|
||||||
@@ -238,7 +246,6 @@
|
|||||||
(org-ql-sort '(start-time))
|
(org-ql-sort '(start-time))
|
||||||
(org-super-agenda-groups
|
(org-super-agenda-groups
|
||||||
'((:auto-ts t)))))))
|
'((:auto-ts t)))))))
|
||||||
|
|
||||||
("qa" "all TODO entries"
|
("qa" "all TODO entries"
|
||||||
((org-ql-block '(and (not (done)) (todo))
|
((org-ql-block '(and (not (done)) (todo))
|
||||||
((org-ql-block-header "all TODOs")
|
((org-ql-block-header "all TODOs")
|
||||||
@@ -301,20 +308,10 @@
|
|||||||
|
|
||||||
(setq org-bookmark-names-plist nil)
|
(setq org-bookmark-names-plist nil)
|
||||||
|
|
||||||
;; 批量调整表格
|
|
||||||
(defun org-table-align-all ()
|
|
||||||
"Ajust all table in current buffer."
|
|
||||||
(interactive)
|
|
||||||
(save-excursion
|
|
||||||
(goto-char (point-min))
|
|
||||||
(org-table-map-tables 'org-table-align t)))
|
|
||||||
|
|
||||||
;; hugo
|
;; hugo
|
||||||
|
|
||||||
;; 安装ox-hugo
|
;; 安装ox-hugo
|
||||||
(use-package ox-hugo)
|
(use-package ox-hugo)
|
||||||
|
|
||||||
|
|
||||||
(with-eval-after-load 'org-capture
|
(with-eval-after-load 'org-capture
|
||||||
(defun org-hugo-new-subtree-post-capture-template ()
|
(defun org-hugo-new-subtree-post-capture-template ()
|
||||||
"Returns `org-capture' template string for new Hugo post.
|
"Returns `org-capture' template string for new Hugo post.
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
(setq show-trailing-whitespace t)
|
(setq show-trailing-whitespace t)
|
||||||
(add-hook 'before-save-hook #'delete-trailing-whitespace nil t))
|
(add-hook 'before-save-hook #'delete-trailing-whitespace nil t))
|
||||||
|
|
||||||
;; Prettify the process list
|
;; Prettify the process list
|
||||||
(with-no-warnings
|
(with-no-warnings
|
||||||
(defun my/list-processes--prettify ()
|
(defun my/list-processes--prettify ()
|
||||||
"Prettify process list."
|
"Prettify process list."
|
||||||
@@ -191,20 +191,16 @@ targets."
|
|||||||
'embark-collect-mode-hook
|
'embark-collect-mode-hook
|
||||||
#'consult-preview-at-point-mode))))
|
#'consult-preview-at-point-mode))))
|
||||||
|
|
||||||
;; nerd-icon
|
|
||||||
;; (use-package nerd-icons)
|
|
||||||
|
|
||||||
;; 启用savehist,保存命令顺序
|
;; 启用savehist,保存命令顺序
|
||||||
(use-package savehist
|
(use-package savehist
|
||||||
;; :hook (after-init . savehist-mode)
|
|
||||||
:init (setq enable-recursive-minibuffers t
|
:init (setq enable-recursive-minibuffers t
|
||||||
history-length 50
|
history-length 50
|
||||||
savehist-additional-variables '(mark-ring
|
savehist-additional-variables '(mark-ring
|
||||||
global-mark-ring
|
global-mark-ring
|
||||||
search-ring
|
search-ring
|
||||||
regexp-search-ring
|
regexp-search-ring
|
||||||
extended-command-history)
|
extended-command-history)
|
||||||
savehist-autosave-interval 300)
|
savehist-autosave-interval 300)
|
||||||
(savehist-mode))
|
(savehist-mode))
|
||||||
|
|
||||||
;; saveplace,保存光标位置
|
;; saveplace,保存光标位置
|
||||||
@@ -220,8 +216,8 @@ targets."
|
|||||||
;; vundop,撤回树
|
;; vundop,撤回树
|
||||||
(use-package vundo
|
(use-package vundo
|
||||||
:init (setq undo-limit 800000
|
:init (setq undo-limit 800000
|
||||||
undo-strong-limit 1200000
|
undo-strong-limit 1200000
|
||||||
undo-outer-limit 12000000))
|
undo-outer-limit 12000000))
|
||||||
|
|
||||||
;; expand-region,快速展开选中
|
;; expand-region,快速展开选中
|
||||||
(use-package expand-region)
|
(use-package expand-region)
|
||||||
@@ -256,9 +252,9 @@ targets."
|
|||||||
(#x3000 . #x303F)
|
(#x3000 . #x303F)
|
||||||
(#xFF00 . #xFFEF)
|
(#xFF00 . #xFFEF)
|
||||||
(#x20000 . #x2A6DF)))
|
(#x20000 . #x2A6DF)))
|
||||||
(let ((start (car range))
|
(let ((start (car range))
|
||||||
(end (cdr range)))
|
(end (cdr range)))
|
||||||
(dotimes (i (- end start))
|
(dotimes (i (- end start))
|
||||||
(modify-syntax-entry (+ start i) "_" jinx--syntax-table)))))
|
(modify-syntax-entry (+ start i) "_" jinx--syntax-table)))))
|
||||||
(require 'init-jinx)))
|
(require 'init-jinx)))
|
||||||
|
|
||||||
@@ -267,18 +263,11 @@ targets."
|
|||||||
|
|
||||||
(use-package flycheck-guile
|
(use-package flycheck-guile
|
||||||
:hook (scheme-mode . (lambda ()
|
:hook (scheme-mode . (lambda ()
|
||||||
(require 'flycheck-guile))))
|
(require 'flycheck-guile))))
|
||||||
|
|
||||||
;; consult-flycheck
|
;; consult-flycheck
|
||||||
(use-package consult-flycheck)
|
(use-package consult-flycheck)
|
||||||
|
|
||||||
;; markdown
|
|
||||||
(use-package markdown-mode
|
|
||||||
:mode ("README\\.md\\'" . gfm-mode)
|
|
||||||
:init (setq markdown-command "multimarkdown")
|
|
||||||
:bind (:map markdown-mode-map
|
|
||||||
("C-c C-e" . markdown-do)))
|
|
||||||
|
|
||||||
;; vterm
|
;; vterm
|
||||||
(unless *is-windows*
|
(unless *is-windows*
|
||||||
(use-package vterm))
|
(use-package vterm))
|
||||||
@@ -286,6 +275,24 @@ targets."
|
|||||||
;; general
|
;; general
|
||||||
(use-package general)
|
(use-package general)
|
||||||
|
|
||||||
|
;; perspective
|
||||||
|
(use-package perspective
|
||||||
|
:bind
|
||||||
|
("C-x M-b" . persp-list-buffers) ; or use a nicer switcher, see below
|
||||||
|
:custom
|
||||||
|
(persp-mode-prefix-key (kbd "C-c p")) ; pick your own prefix key here
|
||||||
|
:init
|
||||||
|
(persp-mode)
|
||||||
|
:config
|
||||||
|
(setq persp-switch-to-buffer-behavior 'switch)
|
||||||
|
(with-eval-after-load 'consult
|
||||||
|
(consult-customize consult-source-buffer :hidden t :default nil)
|
||||||
|
(add-to-list 'consult-buffer-sources persp-consult-source))
|
||||||
|
(setq switch-to-prev-buffer-skip
|
||||||
|
(lambda (win buff bury-or-kill)
|
||||||
|
(not (persp-is-current-buffer buff))))
|
||||||
|
(setq persp-initial-frame-name "desktop"))
|
||||||
|
|
||||||
(provide 'init-package)
|
(provide 'init-package)
|
||||||
|
|
||||||
;;; init-package.el ends here
|
;;; init-package.el ends here
|
||||||
|
|||||||
41
lisp/init-prog.el
Normal file
41
lisp/init-prog.el
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
;;; init.el --- init.el -*- lexical-binding: t -*-
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
;; tree-sitter
|
||||||
|
(use-package treesit-auto
|
||||||
|
:demand t
|
||||||
|
:config
|
||||||
|
(setq treesit-auto-install 'prompt)
|
||||||
|
(global-treesit-auto-mode)
|
||||||
|
(setq treesit-font-lock-level 4))
|
||||||
|
|
||||||
|
;; lua
|
||||||
|
(use-package lua-ts-mode
|
||||||
|
:mode ("\\.lua\\'" . lua-ts-mode)
|
||||||
|
:config
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-ts-mode)))
|
||||||
|
|
||||||
|
;; ahk
|
||||||
|
(use-package ahk-mode)
|
||||||
|
|
||||||
|
;; scheme
|
||||||
|
(use-package geiser
|
||||||
|
:config
|
||||||
|
(with-eval-after-load 'geiser
|
||||||
|
(setq geiser-default-implementation 'guile)))
|
||||||
|
|
||||||
|
;; markdown
|
||||||
|
(use-package markdown-mode
|
||||||
|
:mode ("README\\.md\\'" . gfm-mode)
|
||||||
|
:init (setq markdown-command "multimarkdown")
|
||||||
|
:bind (:map markdown-mode-map
|
||||||
|
("C-c C-e" . markdown-do)))
|
||||||
|
|
||||||
|
(use-package geiser-guile)
|
||||||
|
|
||||||
|
(provide 'init-prog)
|
||||||
|
|
||||||
|
;;; init-prog.el ends here
|
||||||
@@ -5,10 +5,13 @@
|
|||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
;; mac自动全屏
|
;; mac自动全屏
|
||||||
(unless *is-windows*
|
(cond
|
||||||
|
(*is-mac*
|
||||||
(toggle-frame-fullscreen)
|
(toggle-frame-fullscreen)
|
||||||
(global-unset-key (kbd "<f12>"))
|
(global-unset-key (kbd "<f12>"))
|
||||||
(global-set-key (kbd "<f12>") 'toggle-frame-fullscreen))
|
(global-set-key (kbd "<f12>") 'toggle-frame-fullscreen))
|
||||||
|
(*is-linux*
|
||||||
|
(toggle-frame-fullscreen)))
|
||||||
|
|
||||||
;; 配置备份文件和自动保存文件目录
|
;; 配置备份文件和自动保存文件目录
|
||||||
(setq backup-directory-alist
|
(setq backup-directory-alist
|
||||||
@@ -31,15 +34,14 @@
|
|||||||
;; 关闭提示音
|
;; 关闭提示音
|
||||||
(setq ring-bell-function 'ignore)
|
(setq ring-bell-function 'ignore)
|
||||||
|
|
||||||
;; 同步scoop目录
|
;; 同步包管理器目录
|
||||||
(when *is-windows*
|
(cond
|
||||||
|
(*is-windows*
|
||||||
(add-to-list 'exec-path (expand-file-name "H/appppppppppp/scoop/apps/"))
|
(add-to-list 'exec-path (expand-file-name "H/appppppppppp/scoop/apps/"))
|
||||||
(setenv "PATH" (concat (expand-file-name "H/appppppppppp/scoop/apps/") ";" (getenv "PATH"))))
|
(setenv "PATH" (concat (expand-file-name "H/appppppppppp/scoop/apps/") ";" (getenv "PATH"))))
|
||||||
|
(*is-mac*
|
||||||
;; 同步brew目录
|
|
||||||
(when *is-mac*
|
|
||||||
(add-to-list 'exec-path (expand-file-name "/opt/homebrew/bin/"))
|
(add-to-list 'exec-path (expand-file-name "/opt/homebrew/bin/"))
|
||||||
(setenv "PATH" (concat (expand-file-name "/opt/homebrew/bin/") ":" (getenv "PATH"))))
|
(setenv "PATH" (concat (expand-file-name "/opt/homebrew/bin/") ":" (getenv "PATH")))))
|
||||||
|
|
||||||
;; 当文件被外部修改时自动刷新
|
;; 当文件被外部修改时自动刷新
|
||||||
(global-auto-revert-mode 1)
|
(global-auto-revert-mode 1)
|
||||||
@@ -80,6 +82,7 @@
|
|||||||
;; ibuffer
|
;; ibuffer
|
||||||
(setq ibuffer-default-sorting-mode 'filename)
|
(setq ibuffer-default-sorting-mode 'filename)
|
||||||
|
|
||||||
|
;; 关闭native compile警告
|
||||||
(setq native-comp-async-warnings-errors-kind 'silent)
|
(setq native-comp-async-warnings-errors-kind 'silent)
|
||||||
|
|
||||||
;; short anwser
|
;; short anwser
|
||||||
|
|||||||
@@ -16,9 +16,6 @@
|
|||||||
(set-language-environment "UTF-8")
|
(set-language-environment "UTF-8")
|
||||||
(prefer-coding-system 'utf-8)))
|
(prefer-coding-system 'utf-8)))
|
||||||
|
|
||||||
;; 安装autothemer
|
|
||||||
(use-package autothemer)
|
|
||||||
|
|
||||||
;; 预览所有可用emacs颜色
|
;; 预览所有可用emacs颜色
|
||||||
(defun my-color-picker ()
|
(defun my-color-picker ()
|
||||||
"Pick a color with preview."
|
"Pick a color with preview."
|
||||||
@@ -61,13 +58,6 @@
|
|||||||
;; (use-package color-theme-modern)
|
;; (use-package color-theme-modern)
|
||||||
(use-package naysayer-theme)
|
(use-package naysayer-theme)
|
||||||
|
|
||||||
;; modeline
|
|
||||||
;; (use-package smart-mode-line
|
|
||||||
;; :config
|
|
||||||
;; (setq sml/no-confirm-load-theme t)
|
|
||||||
;; ;; sml/theme 'respectful)
|
|
||||||
;; (sml/setup))
|
|
||||||
|
|
||||||
;; (use-package simple-modeline
|
;; (use-package simple-modeline
|
||||||
;; :init (simple-modeline-mode)
|
;; :init (simple-modeline-mode)
|
||||||
;; :config
|
;; :config
|
||||||
@@ -110,68 +100,6 @@
|
|||||||
;; 显示行号列号
|
;; 显示行号列号
|
||||||
(column-number-mode t)
|
(column-number-mode t)
|
||||||
|
|
||||||
;; 配置字体
|
|
||||||
(defvar cn-fonts-list '("Sarasa Fixed TC" "STHeiti" "微软雅黑" "文泉译微米黑")
|
|
||||||
"定义使用的中文字体候选列表")
|
|
||||||
|
|
||||||
(defvar en-fonts-list '("Sarasa Fixed TC" "Courier New" "Monaco" "Ubuntu Mono")
|
|
||||||
"定义使用的英文字体候选列表")
|
|
||||||
|
|
||||||
(defvar emoji-fonts-list '("Apple Color Emoji" "Segoe UI Emoji" "Noto Color Emoji" "Symbola" "Symbol")
|
|
||||||
"定义使用Emoji字体候选列表")
|
|
||||||
|
|
||||||
(defun tenon--available-font (font-list)
|
|
||||||
"从 FONT-LIST 中寻找第一个系统中可用的字"
|
|
||||||
(catch 'found
|
|
||||||
(dolist (font font-list)
|
|
||||||
(when (member font (font-family-list))
|
|
||||||
(throw 'found font)))))
|
|
||||||
|
|
||||||
;; 设置字体大小和字重变量
|
|
||||||
(when *is-windows*
|
|
||||||
(defvar tenon-font-size 125
|
|
||||||
"默认字体大小")
|
|
||||||
(defvar tenon-font-weight 'light
|
|
||||||
"默认字重,选项有ultra-light,light,normal,medium,semibold,bold"))
|
|
||||||
|
|
||||||
(when *is-mac*
|
|
||||||
(defvar tenon-font-size 160
|
|
||||||
"默认字体大小")
|
|
||||||
(defvar tenon-font-weight 'light
|
|
||||||
"默认字重,选项有ultra-light,light,normal,medium,semibold,bold"))
|
|
||||||
|
|
||||||
(when *is-linux*
|
|
||||||
(defvar tenon-font-size 125
|
|
||||||
"默认字体大小")
|
|
||||||
(defvar tenon-font-weight 'normal
|
|
||||||
"默认字重,选项有ultra-light,light,normal,medium,semibold,bold"))
|
|
||||||
|
|
||||||
;; 定义函数
|
|
||||||
;;;###autoload
|
|
||||||
(defun tenon--font-setup ()
|
|
||||||
"Font setup."
|
|
||||||
(interactive)
|
|
||||||
(let* ((cf (tenon--available-font cn-fonts-list))
|
|
||||||
(ef (tenon--available-font en-fonts-list))
|
|
||||||
(em (tenon--available-font emoji-fonts-list)))
|
|
||||||
(when ef
|
|
||||||
(dolist (face '(default fixed-pitch fixed-pitch-serif variable-pitch))
|
|
||||||
(set-face-attribute face nil
|
|
||||||
:family ef
|
|
||||||
:height tenon-font-size
|
|
||||||
:weight tenon-font-weight)))
|
|
||||||
(when em
|
|
||||||
(dolist (charset `(unicode unicode-bmp ,(if (> emacs-major-version 27) 'emoji 'symbol)))
|
|
||||||
(set-fontset-font t charset em nil 'prepend)))
|
|
||||||
(when cf
|
|
||||||
(dolist (charset '(kana han cjk-misc bopomofo))
|
|
||||||
(set-fontset-font t charset cf))
|
|
||||||
(setq face-font-rescale-alist
|
|
||||||
(mapcar (lambda (item) (cons item 1)) `(,cf ,em))))))
|
|
||||||
|
|
||||||
;; 延迟执行字体设置
|
|
||||||
(add-hook 'after-init-hook #'tenon--font-setup)
|
|
||||||
|
|
||||||
;; 添加个人字体到 cnfonts
|
;; 添加个人字体到 cnfonts
|
||||||
(setq cnfonts-personal-fontnames
|
(setq cnfonts-personal-fontnames
|
||||||
'(("Sarasa Fixed TC") ; 英文字体
|
'(("Sarasa Fixed TC") ; 英文字体
|
||||||
@@ -182,8 +110,8 @@
|
|||||||
|
|
||||||
;; 安装cnfonts脚本,用于修复中英文对齐
|
;; 安装cnfonts脚本,用于修复中英文对齐
|
||||||
(use-package cnfonts
|
(use-package cnfonts
|
||||||
:init
|
:hook
|
||||||
(cnfonts-mode 1)
|
(after-init-hook . cnfonts-mode)
|
||||||
:config
|
:config
|
||||||
(cnfonts--select-profile "profile1"))
|
(cnfonts--select-profile "profile1"))
|
||||||
|
|
||||||
|
|||||||
@@ -102,9 +102,6 @@
|
|||||||
(delete-window window)))))
|
(delete-window window)))))
|
||||||
(advice-add #'keyboard-quit :before #'popper-close-window-hack)))
|
(advice-add #'keyboard-quit :before #'popper-close-window-hack)))
|
||||||
|
|
||||||
;; ace-window
|
|
||||||
;; (use-package ace-window)
|
|
||||||
|
|
||||||
;; es-windos,快速管理窗口
|
;; es-windos,快速管理窗口
|
||||||
(use-package es-windows)
|
(use-package es-windows)
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
;;; init-workspace.el --- workspace -*- lexical-binding: t -*-
|
|
||||||
|
|
||||||
;;; Commentary:
|
|
||||||
|
|
||||||
;;; Code:
|
|
||||||
|
|
||||||
(use-package perspective
|
|
||||||
:bind
|
|
||||||
("C-x M-b" . persp-list-buffers) ; or use a nicer switcher, see below
|
|
||||||
:custom
|
|
||||||
(persp-mode-prefix-key (kbd "C-c p")) ; pick your own prefix key here
|
|
||||||
:init
|
|
||||||
(persp-mode)
|
|
||||||
:config
|
|
||||||
(setq persp-switch-to-buffer-behavior 'switch)
|
|
||||||
(with-eval-after-load 'consult
|
|
||||||
(consult-customize consult-source-buffer :hidden t :default nil)
|
|
||||||
(add-to-list 'consult-buffer-sources persp-consult-source))
|
|
||||||
(setq switch-to-prev-buffer-skip
|
|
||||||
(lambda (win buff bury-or-kill)
|
|
||||||
(not (persp-is-current-buffer buff))))
|
|
||||||
(setq persp-initial-frame-name "desktop"))
|
|
||||||
|
|
||||||
(provide 'init-workspace)
|
|
||||||
|
|
||||||
;;; init-workspace.el ends here
|
|
||||||
Reference in New Issue
Block a user