From ff77b5cafedcbb233eb3cc46efdfd5d0912ff629 Mon Sep 17 00:00:00 2001 From: Andsy10 Date: Mon, 18 May 2026 23:03:31 +0800 Subject: [PATCH] chore(config): Add some config for android device --- custom.el | 13 ++++++++ lisp/init-completion.el | 66 ++++++++++++++++++++--------------------- lisp/init-kbd.el | 4 +++ lisp/init-org.el | 4 ++- lisp/init-package.el | 4 ++- lisp/init-startup.el | 4 +-- lisp/init-ui.el | 24 +++++++++++---- 7 files changed, 76 insertions(+), 43 deletions(-) diff --git a/custom.el b/custom.el index e69de29..f2179ce 100644 --- a/custom.el +++ b/custom.el @@ -0,0 +1,13 @@ +;;; -*- lexical-binding: t -*- +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(safe-local-variable-values '((org-use-tag-inheritance)))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) diff --git a/lisp/init-completion.el b/lisp/init-completion.el index b5c30ec..81a71f9 100644 --- a/lisp/init-completion.el +++ b/lisp/init-completion.el @@ -24,41 +24,41 @@ completion-at-point-functions)))))) ;; corfu -(if (display-graphic-p) - (use-package corfu - :autoload - (corfu-quit consult-completion-in-region) - :functions - (persistent-scratch-save) - :custom - (corfu-auto t) - (corfu-auto-prefix 2) - (corfu-count 12) - (corfu-preview-current nil) - (corfu-on-exact-match nil) - (corfu-auto-delay 0.2) - (corfu-popupinfo-delay '(0.4 . 0.2)) - (global-corfu-modes '((not erc-mode - circe-mode - help-mode - gud-mode - vterm-mode) - t)) - :init - (global-corfu-mode) - (corfu-popupinfo-mode) - (corfu-history-mode) - :config - ;;Quit completion before saving - (add-hook 'before-save-hook #'corfu-quit) - (advice-add #'persistent-scratch-save :before #'corfu-quit) - :bind - (:map corfu-map - ("RET" . nil))) - +(use-package corfu + :autoload + (corfu-quit consult-completion-in-region) + :functions + (persistent-scratch-save) + :custom + (corfu-auto t) + (corfu-auto-prefix 2) + (corfu-count 12) + (corfu-preview-current nil) + (corfu-on-exact-match nil) + (corfu-auto-delay 0.2) + (corfu-popupinfo-delay '(0.4 . 0.2)) + (global-corfu-modes '((not erc-mode + circe-mode + help-mode + gud-mode + vterm-mode) + t)) + :init + (global-corfu-mode) + (corfu-popupinfo-mode) + (corfu-history-mode) + :config + ;;Quit completion before saving + (add-hook 'before-save-hook #'corfu-quit) + (advice-add #'persistent-scratch-save :before #'corfu-quit) + :bind + (:map corfu-map + ("RET" . nil))) + +(unless (display-graphic-p) (use-package corfu-terminal :init - (corfu-terminal-mode))) + (add-hook 'global-corfu-mode-hook 'corfu-terminal-mode))) ;; 在eshell中使用tab打开补全 (add-hook 'eshell-mode-hook diff --git a/lisp/init-kbd.el b/lisp/init-kbd.el index a63e5e9..fea9223 100644 --- a/lisp/init-kbd.el +++ b/lisp/init-kbd.el @@ -297,6 +297,10 @@ "C-x r b" 'consult-bookmark "C-;" 'embark-act) +(when *is-android* + (general-def + "C-M-w" 'popper-toggle-type-delete-other-window)) + ;; expand region (setq expand-region-reset-fast-key "r") (setq expand-region-contract-fast-key "c") diff --git a/lisp/init-org.el b/lisp/init-org.el index 3674576..73fd7ee 100644 --- a/lisp/init-org.el +++ b/lisp/init-org.el @@ -76,7 +76,9 @@ :init (denote-rename-buffer-mode) :config - (setq denote-directory "~/org/my-org-note/") + (if *is-android* + (setq denote-directory "~/storage/shared/my-org-note/") + (setq denote-directory "~/org/my-org-note/")) (setq denote-prompts '(title signature keywords)) (setq denote-title-history nil) (setq denote-signature-history diff --git a/lisp/init-package.el b/lisp/init-package.el index 1189072..6edd2e2 100644 --- a/lisp/init-package.el +++ b/lisp/init-package.el @@ -331,8 +331,10 @@ targets." ;; god-mode,模态编辑 (use-package god-mode + :init + (if *is-android* (god-mode-all)) :config - (which-key-enable-god-mode-support) + (unless *is-android* (which-key-enable-god-mode-support)) (setq god-mode-enable-function-key-translation nil) (defun my-sync-line-numbers-with-god-mode () diff --git a/lisp/init-startup.el b/lisp/init-startup.el index 628dbb1..ab6eae7 100644 --- a/lisp/init-startup.el +++ b/lisp/init-startup.el @@ -51,9 +51,9 @@ (global-auto-revert-mode 1) ;; 开启recent file mode -(when (display-graphic-p) +(when (or (display-graphic-p) *is-android*) (recentf-mode) - (setq recentf-max-saved-items 30)) ;; 最大保存数量 + (setq recentf-max-saved-items 30)) ;; 启用select delete (delete-selection-mode) diff --git a/lisp/init-ui.el b/lisp/init-ui.el index c75b110..270b0bc 100644 --- a/lisp/init-ui.el +++ b/lisp/init-ui.el @@ -59,18 +59,30 @@ '(solarized-emacs :fork (:host github :repo "Andsy10/solarized-emacs"))) ;; 把主题加载延迟到frame创建之后,防止daemon模式下宏不能正常展开 -(if (daemonp) - (add-hook 'after-make-frame-functions - (lambda (frame) - (with-selected-frame frame - (load-theme 'my-base16-dark t)))) - (load-theme 'my-base16-dark t)) +(if *is-android* + (if (daemonp) + (add-hook 'after-make-frame-functions + (lambda (frame) + (with-selected-frame frame + (load-theme 'my-base16-light t)))) + (load-theme 'my-base16-light t)) + (if (daemonp) + (add-hook 'after-make-frame-functions + (lambda (frame) + (with-selected-frame frame + (load-theme 'my-base16-dark t)))) + (load-theme 'my-base16-dark t))) ;; 很多主题 ;; (use-package doom-themes) ;; (use-package color-theme-modern) (use-package naysayer-theme) +(if *is-android* + (use-package simple-modeline + :init + (simple-modeline-mode))) + ;; eshell高亮 (use-package eshell-syntax-highlighting :hook