Initial commit
This commit is contained in:
21
lisp/init-better-default.el
Normal file
21
lisp/init-better-default.el
Normal file
@@ -0,0 +1,21 @@
|
||||
;; -*- lexical-binding: t -*-
|
||||
(tool-bar-mode -1)
|
||||
(scroll-bar-mode -1)
|
||||
(display-line-numbers-mode 1)
|
||||
(setq-default cursor-type 'bar)
|
||||
(setq display-line-numbers 'relative)
|
||||
(show-paren-mode t)
|
||||
(recentf-mode 1)
|
||||
(setq recentf-max-menu-item 10)
|
||||
(setq make-backup-files nil)
|
||||
(setq custom-file (expand-file-name "~/.emacs.d/custom.el"))
|
||||
(load custom-file 'no-error 'no-message)
|
||||
|
||||
(global-set-key (kbd "s-a") 'mark-whole-buffer) ;;对应Windows上面的Ctrl-a 全选
|
||||
(global-set-key (kbd "s-c") 'kill-ring-save) ;;对应Windows上面的Ctrl-c 复制
|
||||
(global-set-key (kbd "s-s") 'save-buffer) ;; 对应Windows上面的Ctrl-s 保存
|
||||
(global-set-key (kbd "s-v") 'yank) ;对应Windows上面的Ctrl-v 粘贴
|
||||
(global-set-key (kbd "s-z") 'undo) ;对应Windows上面的Ctrol-z 撤销
|
||||
(global-set-key (kbd "s-x") 'sexp) ;对应Windows上面的Ctrol-x 剪切
|
||||
|
||||
(provide 'init-better-default)
|
||||
12
lisp/init-bindings.el
Normal file
12
lisp/init-bindings.el
Normal file
@@ -0,0 +1,12 @@
|
||||
;; -*- lexical-binding: t -*-
|
||||
|
||||
(define-prefix-command 'orgmode-map)
|
||||
(global-set-key (kbd "C-c n") 'orgmode-map)
|
||||
|
||||
(define-key orgmode-map (kbd "a") #'org-agenda)
|
||||
(define-key orgmode-map (kbd "n") #'org-capture)
|
||||
|
||||
(global-set-key (kbd "C-c g") #'magit-status)
|
||||
|
||||
|
||||
(provide 'init-bindings)
|
||||
5
lisp/init-coding.el
Normal file
5
lisp/init-coding.el
Normal file
@@ -0,0 +1,5 @@
|
||||
;; -*- lexical-binding: t -*-
|
||||
|
||||
(use-package magit)
|
||||
|
||||
(provide 'init-coding)
|
||||
150
lisp/init-completion.el
Normal file
150
lisp/init-completion.el
Normal file
@@ -0,0 +1,150 @@
|
||||
;;; init-completion.el --- Initialize completion configurations. -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2016-2025 Vincent Zhang
|
||||
|
||||
;; Author: Vincent Zhang <seagle0128@gmail.com>
|
||||
;; URL: https://github.com/seagle0128/.emacs.d
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or
|
||||
;; modify it under the terms of the GNU General Public License as
|
||||
;; published by the Free Software Foundation; either version 3, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
;; General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
;; Floor, Boston, MA 02110-1301, USA.
|
||||
;;
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Modern completion configuration.
|
||||
;;
|
||||
|
||||
|
||||
;; Optionally use the `orderless' completion style.
|
||||
(use-package orderless
|
||||
:custom
|
||||
(completion-styles '(orderless basic))
|
||||
(completion-category-defaults nil)
|
||||
(completion-category-overrides '((file (styles basic partial-completion))))
|
||||
(orderless-component-separator #'orderless-escapable-split-on-space))
|
||||
|
||||
;; Support Pinyin
|
||||
(use-package pinyinlib
|
||||
:after orderless
|
||||
:functions orderless-regexp
|
||||
:autoload pinyinlib-build-regexp-string
|
||||
:init
|
||||
(defun orderless-regexp-pinyin (str)
|
||||
"Match COMPONENT as a pinyin regex."
|
||||
(orderless-regexp (pinyinlib-build-regexp-string str)))
|
||||
(add-to-list 'orderless-matching-styles 'orderless-regexp-pinyin))
|
||||
|
||||
;; VERTical Interactive COmpletion
|
||||
(use-package vertico
|
||||
:custom (vertico-count 15)
|
||||
:bind (:map vertico-map
|
||||
("RET" . vertico-directory-enter)
|
||||
("DEL" . vertico-directory-delete-char)
|
||||
("M-DEL" . vertico-directory-delete-word))
|
||||
:init
|
||||
(vertico-mode t))
|
||||
|
||||
;; Enrich existing commands with completion annotations
|
||||
(use-package marginalia
|
||||
:hook (after-init . marginalia-mode))
|
||||
|
||||
;; Consulting completing-read
|
||||
(use-package consult
|
||||
:defines (xref-show-xrefs-function xref-show-definitions-function)
|
||||
:defines shr-color-html-colors-alist
|
||||
:autoload (consult-register-format consult-register-window consult-xref)
|
||||
:autoload (consult--read consult--customize-put)
|
||||
:commands (consult-narrow-help)
|
||||
:functions (list-colors-duplicates consult-colors--web-list)
|
||||
:bind (("C-s" . consult-line)))
|
||||
|
||||
|
||||
(use-package consult-dir
|
||||
:ensure t
|
||||
:bind (("C-x C-d" . consult-dir)
|
||||
:map minibuffer-local-completion-map
|
||||
("C-x C-d" . consult-dir)
|
||||
("C-x C-j" . consult-dir-jump-file)))
|
||||
|
||||
(use-package embark
|
||||
:commands embark-prefix-help-command
|
||||
:bind (("C-;" . embark-act)
|
||||
("M-." . embark-dwim) ; overrides `xref-find-definitions'
|
||||
([remap describe-bindings] . embark-bindings)
|
||||
:map minibuffer-local-map
|
||||
("M-." . my-embark-preview))
|
||||
:init
|
||||
;; Optionally replace the key help with a completing-read interface
|
||||
(setq prefix-help-command #'embark-prefix-help-command))
|
||||
(use-package embark-consult
|
||||
:bind (:map minibuffer-mode-map
|
||||
("C-c C-o" . embark-export))
|
||||
:hook (embark-collect-mode . consult-preview-at-point-mode))
|
||||
|
||||
;; Auto completion
|
||||
(use-package corfu
|
||||
: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))
|
||||
:custom-face
|
||||
(corfu-border ((t (:inherit region :background unspecified))))
|
||||
:bind ("M-/" . completion-at-point)
|
||||
:init
|
||||
(global-corfu-mode)
|
||||
(corfu-history-mode)
|
||||
(corfu-popupinfo-mode)
|
||||
:config
|
||||
;;Quit completion before saving
|
||||
(add-hook 'before-save-hook #'corfu-quit)
|
||||
(advice-add #'persistent-scratch-save :before #'corfu-quit))
|
||||
|
||||
|
||||
;; A few more useful configurations...
|
||||
(use-package emacs
|
||||
:ensure nil
|
||||
:custom
|
||||
;; TAB cycle if there are only few candidates
|
||||
;; (completion-cycle-threshold 3)
|
||||
|
||||
;; Enable indentation+completion using the TAB key.
|
||||
;; `completion-at-point' is often bound to M-TAB.
|
||||
(tab-always-indent 'complete)
|
||||
|
||||
;; Emacs 30 and newer: Disable Ispell completion function. As an alternative,
|
||||
;; try `cape-dict'.
|
||||
(text-mode-ispell-word-completion nil)
|
||||
|
||||
;; Emacs 28 and newer: Hide commands in M-x which do not apply to the current
|
||||
;; mode. Corfu commands are hidden, since they are not used via M-x. This
|
||||
;; setting is useful beyond Corfu.
|
||||
(read-extended-command-predicate #'command-completion-default-include-p))
|
||||
|
||||
(provide 'init-completion)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-completion.el ends here
|
||||
9
lisp/init-edit.el
Normal file
9
lisp/init-edit.el
Normal file
@@ -0,0 +1,9 @@
|
||||
;; -*- lexical-binding: t -*-
|
||||
|
||||
(use-package smartparens
|
||||
:config
|
||||
(require 'smartparens-config)
|
||||
(smartparens-global-mode))
|
||||
|
||||
|
||||
(provide 'init-edit)
|
||||
94
lisp/init-meow.el
Normal file
94
lisp/init-meow.el
Normal file
@@ -0,0 +1,94 @@
|
||||
;; -*- lexical-binding: t -*-
|
||||
|
||||
(defun meow-setup ()
|
||||
(setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty)
|
||||
(meow-motion-define-key
|
||||
'("j" . meow-next)
|
||||
'("k" . meow-prev)
|
||||
'("<escape>" . ignore))
|
||||
(meow-leader-define-key
|
||||
;; Use SPC (0-9) for digit arguments.
|
||||
'("1" . meow-digit-argument)
|
||||
'("2" . meow-digit-argument)
|
||||
'("3" . meow-digit-argument)
|
||||
'("4" . meow-digit-argument)
|
||||
'("5" . meow-digit-argument)
|
||||
'("6" . meow-digit-argument)
|
||||
'("7" . meow-digit-argument)
|
||||
'("8" . meow-digit-argument)
|
||||
'("9" . meow-digit-argument)
|
||||
'("0" . meow-digit-argument)
|
||||
'("/" . meow-keypad-describe-key)
|
||||
'("?" . meow-cheatsheet))
|
||||
(meow-normal-define-key
|
||||
'("0" . meow-expand-0)
|
||||
'("9" . meow-expand-9)
|
||||
'("8" . meow-expand-8)
|
||||
'("7" . meow-expand-7)
|
||||
'("6" . meow-expand-6)
|
||||
'("5" . meow-expand-5)
|
||||
'("4" . meow-expand-4)
|
||||
'("3" . meow-expand-3)
|
||||
'("2" . meow-expand-2)
|
||||
'("1" . meow-expand-1)
|
||||
'("-" . negative-argument)
|
||||
'(";" . meow-reverse)
|
||||
'("," . meow-inner-of-thing)
|
||||
'("." . meow-bounds-of-thing)
|
||||
'("[" . meow-beginning-of-thing)
|
||||
'("]" . meow-end-of-thing)
|
||||
'("a" . meow-append)
|
||||
'("A" . meow-open-below)
|
||||
'("b" . meow-back-word)
|
||||
'("B" . meow-back-symbol)
|
||||
'("c" . meow-change)
|
||||
'("d" . meow-delete)
|
||||
'("D" . meow-backward-delete)
|
||||
'("e" . meow-next-word)
|
||||
'("E" . meow-next-symbol)
|
||||
'("f" . meow-find)
|
||||
'("g" . meow-cancel-selection)
|
||||
'("G" . meow-grab)
|
||||
'("h" . meow-left)
|
||||
'("H" . meow-left-expand)
|
||||
'("i" . meow-insert)
|
||||
'("I" . meow-open-above)
|
||||
'("j" . meow-next)
|
||||
'("J" . meow-next-expand)
|
||||
'("k" . meow-prev)
|
||||
'("K" . meow-prev-expand)
|
||||
'("l" . meow-right)
|
||||
'("L" . meow-right-expand)
|
||||
'("m" . meow-join)
|
||||
'("n" . meow-search)
|
||||
'("o" . meow-block)
|
||||
'("O" . meow-to-block)
|
||||
'("p" . meow-yank)
|
||||
'("q" . meow-quit)
|
||||
'("Q" . meow-goto-line)
|
||||
'("r" . meow-replace)
|
||||
'("R" . meow-swap-grab)
|
||||
'("s" . meow-kill)
|
||||
'("t" . meow-till)
|
||||
'("u" . meow-undo)
|
||||
'("U" . meow-undo-in-selection)
|
||||
'("v" . meow-visit)
|
||||
'("w" . meow-mark-word)
|
||||
'("W" . meow-mark-symbol)
|
||||
'("x" . meow-line)
|
||||
'("X" . meow-goto-line)
|
||||
'("y" . meow-save)
|
||||
'("Y" . meow-sync-grab)
|
||||
'("z" . meow-pop-selection)
|
||||
'("'" . repeat)
|
||||
'("<escape>" . ignore)))
|
||||
|
||||
(use-package meow
|
||||
:init
|
||||
(meow-global-mode 1)
|
||||
:config
|
||||
(meow-setup)
|
||||
(setq meow-cursor-type-normal 'bar)
|
||||
)
|
||||
|
||||
(provide 'init-meow)
|
||||
54
lisp/init-org.el
Normal file
54
lisp/init-org.el
Normal file
@@ -0,0 +1,54 @@
|
||||
;; -*- lexical-binding: t -*-
|
||||
|
||||
;; (defun org-capture-init()
|
||||
;; (setq org-capture-templates
|
||||
;; '(("t" "Personal todo" entry ("Inbox")
|
||||
;; "* TODO %?\n%i\n%a" :prepend t))))
|
||||
|
||||
(use-package org
|
||||
:defer
|
||||
:ensure `(org :repo "https://code.tecosaur.net/tec/org-mode.git/"
|
||||
:branch "dev")
|
||||
:hook (org-mode . org-modern-mode)
|
||||
:config
|
||||
;; (org-capture-init)
|
||||
(add-to-list 'org-modules 'org-habit)
|
||||
(setq org-directory "~/org/")
|
||||
)
|
||||
(use-package org-modern
|
||||
:config
|
||||
(setq org-modern-table nil))
|
||||
|
||||
(use-package org-latex-preview
|
||||
:defer
|
||||
:ensure nil
|
||||
:config
|
||||
;; Increase preview width
|
||||
(plist-put org-latex-preview-appearance-options
|
||||
:page-width 0.8)
|
||||
|
||||
;; ;; Use dvisvgm to generate previews
|
||||
;; ;; You don't need this, it's the default:
|
||||
;; (setq org-latex-preview-process-default 'dvisvgm)
|
||||
|
||||
;; Turn on `org-latex-preview-mode', it's built into Org and much faster/more
|
||||
;; featured than org-fragtog. (Remember to turn off/uninstall org-fragtog.)
|
||||
(add-hook 'org-mode-hook 'org-latex-preview-mode)
|
||||
|
||||
;; ;; Block C-n, C-p etc from opening up previews when using `org-latex-preview-mode'
|
||||
;; (setq org-latex-preview-mode-ignored-commands
|
||||
;; '(next-line previous-line mwheel-scroll
|
||||
;; scroll-up-command scroll-down-command))
|
||||
|
||||
;; ;; Enable consistent equation numbering
|
||||
;; (setq org-latex-preview-numbered t)
|
||||
|
||||
;; Bonus: Turn on live previews. This shows you a live preview of a LaTeX
|
||||
;; fragment and updates the preview in real-time as you edit it.
|
||||
;; To preview only environments, set it to '(block edit-special) instead
|
||||
(setq org-latex-preview-mode-display-live t)
|
||||
|
||||
;; More immediate live-previews -- the default delay is 1 second
|
||||
(setq org-latex-preview-mode-update-delay 0.25))
|
||||
|
||||
(provide 'init-org)
|
||||
10
lisp/init-snippet.el
Normal file
10
lisp/init-snippet.el
Normal file
@@ -0,0 +1,10 @@
|
||||
(use-package! yasnippet
|
||||
:config
|
||||
(defun my-yas-try-expanding-auto-snippets ()
|
||||
(when yas-minor-mode
|
||||
(let ((yas-buffer-local-condition ''(require-snippet-condition . auto)))
|
||||
(yas-expand))))
|
||||
(add-hook 'post-command-hook #'my-yas-try-expanding-auto-snippets)
|
||||
)
|
||||
|
||||
(provide 'init-snippet)
|
||||
109
lisp/init-ui.el
Normal file
109
lisp/init-ui.el
Normal file
@@ -0,0 +1,109 @@
|
||||
;; -*- lexical-binding: t -*-
|
||||
|
||||
(setq idle-update-delay 1.0)
|
||||
|
||||
(setq-default cursor-in-non-selected-windows nil)
|
||||
(setq highlight-nonselected-windows nil)
|
||||
|
||||
(setq fast-but-imprecise-scrolling t)
|
||||
(setq redisplay-skip-fontification-on-input t)
|
||||
|
||||
(setq frame-inhibit-implied-resize t
|
||||
frame-resize-pixelwise t)
|
||||
|
||||
(use-package solaire-mode
|
||||
:hook (after-init . solaire-global-mode))
|
||||
(use-package ef-themes
|
||||
:ensure t
|
||||
:init
|
||||
;; This makes the Modus commands listed below consider only the Ef
|
||||
;; themes. For an alternative that includes Modus and all
|
||||
;; derivative themes (like Ef), enable the
|
||||
;; `modus-themes-include-derivatives-mode' instead. The manual of
|
||||
;; the Ef themes has a section that explains all the possibilities:
|
||||
;;
|
||||
;; - Evaluate `(info "(ef-themes) Working with other Modus themes or taking over Modus")'
|
||||
;; - Visit <https://protesilaos.com/emacs/ef-themes#h:6585235a-5219-4f78-9dd5-6a64d87d1b6e>
|
||||
(ef-themes-take-over-modus-themes-mode 1)
|
||||
:bind
|
||||
(("<f5>" . modus-themes-rotate)
|
||||
("C-<f5>" . modus-themes-select)
|
||||
("M-<f5>" . modus-themes-load-random))
|
||||
:config
|
||||
;; All customisations here.
|
||||
(setq modus-themes-mixed-fonts t)
|
||||
(setq modus-themes-italic-constructs t)
|
||||
|
||||
;; Finally, load your theme of choice (or a random one with
|
||||
;; `modus-themes-load-random', `modus-themes-load-random-dark',
|
||||
;; `modus-themes-load-random-light').
|
||||
(modus-themes-load-theme 'ef-day))
|
||||
|
||||
(use-package rainbow-delimiters
|
||||
:hook ((prog-mode . rainbow-delimiters-mode)
|
||||
(typst-ts-mode . rainbow-delimiters-mode)
|
||||
(foo-mode . rainbow-delimiters-mode)))
|
||||
|
||||
(use-package doom-modeline
|
||||
:init (doom-modeline-mode 1))
|
||||
|
||||
(use-package hide-mode-line
|
||||
:autoload turn-off-hide-mode-line-mode
|
||||
:hook (((eat-mode
|
||||
eshell-mode shell-mode
|
||||
term-mode vterm-mode
|
||||
embark-collect-mode lsp-ui-imenu-mode
|
||||
pdf-annot-list-mode) . turn-on-hide-mode-line-mode)))
|
||||
|
||||
;; Suppress GUI features
|
||||
(setq use-file-dialog nil
|
||||
use-dialog-box nil
|
||||
inhibit-startup-screen t
|
||||
inhibit-startup-echo-area-message user-login-name
|
||||
inhibit-default-init t
|
||||
initial-scratch-message nil)
|
||||
(unless (daemonp)
|
||||
(advice-add #'display-startup-echo-area-message :override #'ignore))
|
||||
|
||||
;; Display dividers between windows
|
||||
(setq window-divider-default-places t
|
||||
window-divider-default-bottom-width 1
|
||||
window-divider-default-right-width 1)
|
||||
(add-hook 'window-setup-hook #'window-divider-mode)
|
||||
|
||||
(pcase system-type
|
||||
('darwin ; macOS
|
||||
(set-face-attribute 'default nil :font "Maple Mono-16")
|
||||
(add-to-list 'default-frame-alist '(height . 53))
|
||||
(add-to-list 'default-frame-alist '(width . 120)))
|
||||
|
||||
('gnu/linux ; Linux (including Debian)
|
||||
(set-face-attribute 'default nil :font "Maple Mono-16") ; 20 * 1.5
|
||||
(add-to-list 'default-frame-alist '(height . 40))
|
||||
(add-to-list 'default-frame-alist '(width . 100))))
|
||||
|
||||
|
||||
|
||||
;; Easily adjust the font size in all frames
|
||||
(use-package default-text-scale
|
||||
:hook (after-init . default-text-scale-mode)
|
||||
:bind (:map default-text-scale-mode-map
|
||||
("s-=" . default-text-scale-increase)
|
||||
("s--" . default-text-scale-decrease)
|
||||
("s-0" . default-text-scale-reset)
|
||||
("C-s-=" . default-text-scale-increase)
|
||||
("C-s--" . default-text-scale-decrease)
|
||||
("C-s-0" . default-text-scale-reset)))
|
||||
|
||||
(setq hscroll-step 1
|
||||
hscroll-margin 2
|
||||
scroll-step 1
|
||||
scroll-margin 0
|
||||
scroll-conservatively 100000
|
||||
scroll-preserve-screen-position t
|
||||
auto-window-vscroll nil
|
||||
;; mouse
|
||||
mouse-wheel-scroll-amount-horizontal 1
|
||||
mouse-wheel-progressive-speed nil)
|
||||
|
||||
(provide 'init-ui)
|
||||
Reference in New Issue
Block a user