Remove unused parts and reorganize config files.

This commit is contained in:
2025-08-26 18:12:39 +08:00
parent 92c3e19a46
commit 6237f2b756
49 changed files with 15552 additions and 4344 deletions

View File

@@ -1,10 +0,0 @@
;;; Require
(require 'ace-window)
;;; Code:
;; 0-9 by default
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
(provide 'init-ace-window)
;;; init-ace-window.el ends here

View File

@@ -8,6 +8,16 @@
(with-eval-after-load 'company
(company-ctags-auto-setup))
; remove company backend company-dabbrev-code
(setq company-backends
(mapcar (lambda (backend)
(cond
((eq backend 'company-dabbrev-code) nil)
((listp backend)
(remove 'company-dabbrev-code backend))
(t backend)))
company-backends))
(provide 'init-company-mode)
;;; init-company-mode.el ends here

View File

@@ -1,23 +1,9 @@
;; -*- coding: utf-8; -*-
;;; Require:
(require 'dired-display-buffer)
(require 'dired-narrow)
(require 'dired-subtree)
;;; Code:
(setq dired-listing-switches "-alh1v --group-directories-first")
;; dired-subtree
(setq dired-subtree-line-prefix " ")
(setq dired-subtree-cycle-depth 3) ;; default `3'
(setq dired-subtree-use-backgrounds nil) ;; default `t'
;; (set-face-attribute 'dired-subtree-depth-1-face nil :background "#ced9db")
;; (set-face-attribute 'dired-subtree-depth-2-face nil :background "#bbc9cc")
;; (set-face-attribute 'dired-subtree-depth-3-face nil :background "#a7babe")
;; (set-face-attribute 'dired-subtree-depth-4-face nil :background "#94aaaf")
;; (set-face-attribute 'dired-subtree-depth-5-face nil :background "#809ba2")
;; (set-face-attribute 'dired-subtree-depth-6-face nil :background "#6c8b93")
(provide 'init-dired)
;;; init-dired.el ends here

View File

@@ -0,0 +1,16 @@
;; -*- coding: utf-8; -*-
;;; Require:
;;; Code:
;; font
(when (and window-system *win64*)
(let ((default-font (font-spec :name "LXGW WenKai Mono"))
(cn-font (font-spec :name "LXGW WenKai Mono")))
(set-face-attribute 'default nil :font default-font :height 120)
(dolist (charset '(kana han symbol cjk-misc bopomofo))
(set-fontset-font t charset cn-font)))
(set-face-font 'fixed-pitch "LXGW WenKai Mono"))
(provide 'init-font)
;;; init-font.el ends here

View File

@@ -33,6 +33,9 @@
(global-visual-line-mode t)
(setq word-wrap-by-category t) ;; enhanced CJK word wrap since Emacs28
;; warning in opening large file
(setq large-file-warning-threshold (* 20 1024 1024))
;; line number and column number
(global-display-line-numbers-mode t) ;; show line numbers in every mode
(column-number-mode t) ;; show column number

View File

@@ -1,7 +1,5 @@
;; -*- coding: utf-8; -*-
;;; Require:
(require 'jsonian)
(require 'lua-mode)
;;; Code:
;; bind ext to a specific mode
@@ -19,74 +17,38 @@ The test for presence of the car of ELT-CONS is done with `equal'."
(symbol-value alist-var))
(dolist (elt-cons '(
("\\.c\\'" . c-mode)
("\\.org\\'" . org-mode)
("\\.stumpwmrc\\'" . lisp-mode)
("\\.jl\\'" . lisp-mode)
("\\.asdf\\'" . lisp-mode)
("\\.py\\'" . python-mode)
("\\.markdown" . markdown-mode)
("\\.md" . markdown-mode)
("\\.inc\\'" . asm-mode)
("\\.py\\'" . python-mode)
("SConstruct". python-mode)
("\\.lua\\'" . lua-mode)
("\\.json\\'" . jsonian-mode)
("\\.go\\'" . go-mode)
("\\.css\\'" . css-mode)
("\\.wxss\\'" . css-mode)
("\\.pdf\\'" . pdf-view-mode)
("\\.ts\\'" . typescript-mode)
("\\.tsx\\'" . typescript-mode)
("\\.js.erb\\'" . web-mode)
("\\.css\\'" . web-mode)
("\\.wxss\\'" . web-mode)
("\\.js\\'" . web-mode)
("\\.wxs\\'" . web-mode)
("\\.vue" . web-mode)
("\\.wxml" . web-mode)
("\\.blade\\.php\\'" . web-mode)
("\\.phtml\\'" . web-mode)
("\\.tpl\\.php\\'" . web-mode)
("\\.jsp\\'" . web-mode)
("\\.mustache\\'" . web-mode)
("\\.djhtml\\'" . web-mode)
("\\.html?\\'" . web-mode)
("\\.jsx\\'" . web-mode)
("\\.wxml" . web-mode)
;; ("\\.rs$" . rust-mode)
("CMakeLists\\.txt\\'" . cmake-mode)
("\\.cmake\\'" . cmake-mode)
))
(add-to-alist 'auto-mode-alist elt-cons))
;;; Mode load.
(autoload 'cmake-mode "cmake-mode")
(autoload 'css-mode "css-mode")
(autoload 'go-mode "go-mode")
(require 'jsonian)
(autoload 'jsonian-mode "jsonian-mode")
(autoload 'lua-mode "lua-mode")
(setq lua-indent-level 2)
(autoload 'markdown-mode "markdown-mode")
(autoload 'python-mode "init-python")
(autoload 'web-mode "web-mode")
;; (autoload 'rust-mode "rust-mode")
(provide 'init-mode)
;;; init-mode.el ends here

View File

@@ -1,12 +0,0 @@
;; -*- coding: utf-8; -*-
;;; Require:
(require 'neotree)
;;; Code:
(setq neo-theme 'ascii)
(setq neo-show-hidden-files t)
(setq neo-window-width 40)
(provide 'init-neotree)
;;; init-neotree.el ends here

View File

@@ -1,57 +1,49 @@
;; -*- coding: utf-8; -*-
;;; There are 3 sections:
;;; There are 4 sections:
;;; - unset keys
;;; - extensions
;;; - extensions-local
;;; - shortcut on built-in function
;;; - shortcut for built-in function
;;; ------------ unset keys
; originally
; 'C-i' is TAB
; 'C-r' is isearch-backward
(lazy-load-unset-keys
'("C-z" "C-\\" "C-'" "C-i" "C-r"))
'("C-z" "C-\\" "C-'"))
;;; ------------ extensions
;; ------ ace-window
(lazy-load-global-keys
'(
("M-o" . ace-window)
)
"init-ace-window")
;; ------ avy
(lazy-load-global-keys
'(
("M-g c" . avy-goto-char)
("M-g w" . avy-goto-word-1)
("M-g s" . avy-goto-word-0)
("M-g l l" . avy-goto-line)
("M-g j" . avy-next)
("M-g k" . avy-prev)
("C-; c" . avy-goto-char)
("C-; w" . avy-goto-word-1)
("C-; s" . avy-goto-word-0)
("C-; h" . avy-goto-line)
("C-; j" . avy-next)
("C-; k" . avy-prev)
)
"init-avy")
;; ------ citre
(lazy-load-global-keys
'(
("C-x c c" . citre-mode)
("C-x c j" . citre-jump)
("C-x c J" . citre-jump-back)
("C-x c p" . citre-ace-peek)
("C-x c u" . citre-update-this-tags-file)
("C-z c" . citre-mode)
("C-' j" . citre-jump)
("C-' J" . citre-jump-back)
("C-' p" . citre-ace-peek)
("C-' u" . citre-update-this-tags-file)
)
"init-citre")
;; ------ theme
(lazy-load-global-keys
'(
("<f5>" . ld-modus-themes-toggle)
("C-x t s" . ld-modus-themes-toggle)
)
"init-theme")
@@ -67,36 +59,14 @@
)
"multiple-cursors")
;; ------ swiper
(lazy-load-set-keys
'(
("C-s" . swiper-isearch)
("C-c s" . counsel-rg)
))
;;; ------------ extensions-local
(lazy-load-set-keys
'(
;; dired-display-buffer
("o" . dired-display-buffer)
;; dired-narrow
("/" . dired-narrow)
;; dired-subtree
("<tab>" . dired-subtree-cycle)
("SPC" . dired-subtree-toggle)
("C-p" . dired-subtree-previous-sibling)
("C-n" . dired-subtree-next-sibling)
("r" . dired-subtree-revert)
)
dired-mode-map)
(lazy-load-global-keys
'(
("C-c e e" . toggle-echo-keys)
("C-c e c" . echo-keys-clean)
("C-z e e" . toggle-echo-keys)
("C-z e c" . echo-keys-clean)
)
"echo-keys") ;show every pressed keys
@@ -108,67 +78,40 @@
(lazy-load-global-keys
'(
("C-<" . ld-un-indent)
("C-<" . ld-unindent)
("C->" . ld-indent)
)
"force-indent") ;control 4 spaces indent manually
(lazy-load-global-keys
'(
("C-c \\" . goto-last-change)
)
"goto-last-change")
(lazy-load-global-keys
'(
("M-g l p" . goto-line-preview)
("C-; l" . goto-line-preview)
("C-; r" . goto-line-preview-relative)
)
"goto-line-preview")
(lazy-load-global-keys
'(
("C-c m h a" . highlight-indentation-mode)
("C-c m h c" . highlight-indentation-current-column-mode)
("C-z h i a" . highlight-indentation-mode)
("C-z h i c" . highlight-indentation-current-column-mode)
)
"highlight-indentation")
(lazy-load-global-keys
'(
("C-r i" . ld-indent-buffer)
("C-r r" . ld-rename-file-and-buffer)
("C-r d" . ld-delete-file-and-buffer)
("C-r e" . ld-revert-buffer-no-confirm)
("C-i r" . ld-find-file-in-root) ; open file with root by sudo
("C-c I" . ld-indent-buffer)
("C-x R r" . ld-rename-file-and-buffer)
("C-x D" . ld-delete-file-and-buffer)
("C-x e" . ld-revert-buffer-no-confirm)
("C-x R R" . ld-find-file-in-root)
)
"ld-buffer-operations")
"ld-file-and-buffer-operations")
(lazy-load-global-keys
'(
("C-;" . ld-cursor-position-1-store) ;store cursor position
("C-'" . ld-cursor-position-1-jump) ;jump to cursor position
("C-c ," . ld-cursor-position-stack-push) ;push cursor position to stack
("C-c ." . ld-cursor-position-stack-pop) ;pop corsor position from stack
)
"ld-goto-cursor-stack")
(lazy-load-global-keys
'(
("M-N" . ld-delete-one-block-backward)
("M-M" . ld-delete-one-block-forward)
)
"ld-delete-block") ;delete a block (eg. a word) forward and backward
(lazy-load-global-keys
'(
("C-i r" . ld-find-file-in-root) ; open file with root by sudo
)
"ld-file-operations")
(lazy-load-global-keys
'(
("M-g l p" . ld-goto-percent-line)
("M-g t p" . ld-goto-percent-text)
("M-g t c" . ld-goto-column)
("C-; p n" . ld-goto-percent-line)
("C-; p t" . ld-goto-percent-text)
("C-; f" . ld-goto-column)
)
"ld-goto-simple")
@@ -185,22 +128,16 @@
(lazy-load-global-keys
'(
("C-c w t" . ld-toggle-one-window)
("C-M-J" . scroll-next-window-up-line)
("C-M-H" . scroll-next-window-up)
("C-M-K" . scroll-next-window-down-line)
("C-M-L" . scroll-next-window-down)
("C-M-U" . scroll-previous-window-up-line)
("C-M-Y" . scroll-previous-window-up)
("C-M-I" . scroll-previous-window-down-line)
("C-M-O" . scroll-previous-window-down)
)
"ld-toggle-one-window") ;maxmize current window and size back
(lazy-load-global-keys
'(("C-x j" . neotree-toggle))
"init-neotree")
(lazy-load-global-keys
'(
("M-j" . watch-next-window-up-line) ; 'up' to see previous content
("M-k" . watch-next-window-down-line) ; 'down' to see further content
("M-J" . watch-next-window-up)
("M-K" . watch-next-window-down)
)
"scroll-next-window")
"scroll-adjacent-window")
(lazy-load-global-keys
'(
@@ -210,7 +147,7 @@
;;; ------------ shortcut on built-in function
;;; ------------ shortcut for built-in function
;; ------ org related
(lazy-load-set-keys
@@ -220,31 +157,28 @@
("C-c o l r" . org-list-repair)
))
;; ------ move cursors in current buffer
;; ------ switch between windows
(lazy-load-set-keys
'(
("M-g b k" . beginning-of-buffer)
("M-g b j" . end-of-buffer)
("M-g h j" . forward-paragraph)
("M-g h k" . backward-paragraph)
("M-g l y" . backward-up-list) ;向左跳出 LIST
("M-g l o" . up-list) ;向右跳出 LIST
("M-g l u" . backward-down-list) ;向左跳进 LIST
("M-g l i" . down-list) ;向右跳进 LIST
("M-g f a" . beginning-of-defun) ;函数开头
("M-g f e" . end-of-defun) ;函数末尾
("M-k" . windmove-up)
("M-j" . windmove-down)
("M-i" . windmove-left)
("M-o" . windmove-right)
("M-K" . shrink-window)
("M-J" . enlarge-window)
("M-O" . shrink-window-horizontally)
("M-I" . enlarge-window-horizontally)
))
;; ------ other
(lazy-load-set-keys
'(
("C-z r" . global-hl-line-mode)
("C-z l" . display-line-numbers-mode)
("C-z h l" . global-hl-line-mode)
("C-z n m" . display-line-numbers-mode)
("M--" . text-scale-decrease)
("M-=" . text-scale-increase)
("M-," . bury-buffer)
("M-." . unbury-buffer)
("C-c m m" . set-mark-command) ; replace C-Space for Chinese input method
("M-N" . bury-buffer)
("M-P" . unbury-buffer)
("M-;" . comment-dwim)
("C-c r" . recentf-open-files)
))

View File

@@ -1,34 +0,0 @@
;; -*- coding: utf-8; -*-
;;; Require:
(require 'ivy)
(require 'counsel)
(require 'swiper)
;;; Code:
(setq ivy-use-virtual-buffers t)
(setq ivy-initial-inputs-alist nil)
(setq ivy-count-format "(%d/%d) ")
;; Map commands to their minimum required input length.
;; That is the number of characters prompted for before fetching
;; candidates. The special key t is used as a fallback.
(setq ivy-more-chars-alist '((t . 2)))
(ivy-mode 1)
(setq counsel-rg-base-command
`("rg"
"--max-columns" "0"
"--with-filename"
"--no-heading"
"--line-number"
"--color" "never"
"%s"
,@(and (memq system-type '(ms-dos windows-nt))
(list "--path-separator" "/" "."))))
(counsel-mode 1)
(provide 'init-swiper)
;; init-swiper.el ends here

View File

@@ -1,18 +1,7 @@
;; -*- coding: utf-8; -*-
;;; Require:
(require 'modus-themes)
;;; Code:
;; font
(when (and window-system *win64*)
(let ((default-font (font-spec :name "Sarasa Fixed SC"))
(cn-font (font-spec :name "Sarasa Fixed SC")))
(set-face-attribute 'default nil :font default-font :height 116)
(dolist (charset '(kana han symbol cjk-misc bopomofo))
(set-fontset-font t charset cn-font)))
(set-face-font 'fixed-pitch "Sarasa Fixed SC"))
;; theme
;; In all of the following, WEIGHT is a symbol such as `semibold',
;; `light', `bold', or anything mentioned in `modus-themes-weights'.
(setq modus-themes-italic-constructs t

View File

@@ -1,6 +1,5 @@
;; -*- coding: utf-8; -*-
;;; Require:
(require 'which-key)
;;; Code:
(setq which-key-show-early-on-C-h t)

View File

@@ -12,7 +12,7 @@
;; from local extensions
;; firstly loaded part
(require 'init-theme)
(require 'init-font)
(require 'lazy-load)
(require 'init-generic)
(require 'ld-tools)
@@ -27,11 +27,13 @@
(require 'init-org-todo)
(require 'init-org)
(require 'init-proxy)
(require 'init-swiper)
(require 'init-time)
(require 'init-undo-tree)
(require 'init-which-key)
(require 'init-yasnippet)
(when *emacs30*
(require 'init-theme)
(require 'init-which-key))
;; restore session
(require 'init-session)