Config: streamline minimal terminal config
This commit is contained in:
8
init.el
8
init.el
@@ -13,8 +13,6 @@
|
||||
(when (file-exists-p custom-file)
|
||||
(load-file custom-file))
|
||||
|
||||
(global-display-line-numbers-mode t)
|
||||
|
||||
(if (display-graphic-p)
|
||||
(progn
|
||||
(require 'init-const)
|
||||
@@ -35,13 +33,11 @@
|
||||
(require 'init-kbd)
|
||||
(require 'init-segmentation))
|
||||
(progn
|
||||
(require 'init-const)
|
||||
(require 'init-terminal-startup)
|
||||
(load "init-proxy" t)
|
||||
(require 'init-startup)
|
||||
(require 'init-elpa)
|
||||
(require 'init-terminal-package)
|
||||
(require 'init-terminal-ui)
|
||||
(require 'init-terminal-kbd)
|
||||
(require 'init-segmentation)))
|
||||
(require 'init-terminal-kbd)))
|
||||
|
||||
;;; init.el ends here
|
||||
|
||||
@@ -51,11 +51,6 @@
|
||||
:bind (:map corfu-map
|
||||
("RET" . nil)))
|
||||
|
||||
(unless (or (display-graphic-p)
|
||||
(featurep 'tty-child-frames))
|
||||
(use-package corfu-terminal
|
||||
:hook (global-corfu-mode . corfu-terminal-mode)))
|
||||
|
||||
;; 在eshell中使用tab打开补全
|
||||
(add-hook 'eshell-mode-hook
|
||||
(lambda ()
|
||||
|
||||
@@ -38,6 +38,16 @@
|
||||
straight-use-package-version t
|
||||
straight-use-package-by-default t)
|
||||
|
||||
;; 安装gcmh用于管理内存回收
|
||||
(use-package gcmh
|
||||
:demand t
|
||||
:init
|
||||
(setq gcmh-idle-delay 'auto
|
||||
gcmh-auto-idle-delay-factor 10
|
||||
gcmh-high-cons-threshold #x4000000)
|
||||
:config
|
||||
(gcmh-mode 1))
|
||||
|
||||
;; 安装benchmark-init
|
||||
(use-package benchmark-init
|
||||
:init (benchmark-init/activate)
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
;; 开启水平滚动
|
||||
(put 'scroll-left 'disabled nil)
|
||||
|
||||
;; 行号
|
||||
(global-display-line-numbers-mode t)
|
||||
|
||||
;; 关闭lock文件
|
||||
(setq create-lockfiles nil)
|
||||
|
||||
|
||||
@@ -16,32 +16,18 @@
|
||||
(duplicate-line)
|
||||
(next-line)))
|
||||
|
||||
(defun popper-toggle-type-delete-other-window()
|
||||
"Toggle type of popper window and delete other window."
|
||||
(interactive)
|
||||
(popper-toggle-type)
|
||||
(delete-other-windows))
|
||||
|
||||
;; scratch buffer
|
||||
(if *is-mac*
|
||||
(general-def "C-c <f12>" 'scratch-buffer)
|
||||
(general-def "C-c <delete>" 'scratch-buffer))
|
||||
|
||||
;; org-mode
|
||||
(general-def org-mode-map
|
||||
"C-<tab>" 'org-cycle-parent-subtree
|
||||
"C-c o l" 'org-toggle-link-display
|
||||
"C-c C-k" 'kmacro-call-macro
|
||||
"M-{" 'org-previous-visible-heading
|
||||
"M-}" 'org-next-visible-heading)
|
||||
|
||||
;; global map with C-c prefix
|
||||
(general-def
|
||||
:prefix "C-c"
|
||||
"c" 'hydra-multiple-cursors/body
|
||||
"e" 'er/expand-region
|
||||
"k" 'comment-line
|
||||
"v" 'vterm)
|
||||
"f r" 'recentf
|
||||
"i" 'imenu)
|
||||
|
||||
;; global map
|
||||
(general-def
|
||||
@@ -52,6 +38,7 @@
|
||||
"M-]" 'next-buffer
|
||||
"C-x C-b" 'ibuffer-other-window
|
||||
"C-x K" 'crux-kill-other-buffers
|
||||
"C-x C-b" 'ibuffer-other-window
|
||||
|
||||
;; edit
|
||||
"M-c" 'capitalize-dwim
|
||||
@@ -62,9 +49,9 @@
|
||||
"C-<backspace>" 'crux-kill-line-backwards
|
||||
"C-o" 'open-line
|
||||
"C-a" 'crux-move-beginning-of-line
|
||||
"M-y" 'consult-yank-from-kill-ring
|
||||
"C-c <backspace>" 'hungry-delete-backward
|
||||
"C-c C-<backspace>" 'hungry-delete-forward
|
||||
"M-y" 'yank-from-kill-ring
|
||||
"C-c DEL" 'hungry-delete-backward
|
||||
"C-c C-DEL" 'hungry-delete-forward
|
||||
"M-P" 'drag-stuff-up
|
||||
"M-N" 'drag-stuff-down
|
||||
|
||||
@@ -75,27 +62,13 @@
|
||||
;; navigate
|
||||
"M-p" 'backward-paragraph
|
||||
"M-n" 'forward-paragraph
|
||||
"<mouse-2>" 'xref-find-definitions-at-mouse
|
||||
"C-M-;" 'avy-goto-char
|
||||
"C-M-'" 'avy-goto-word-1
|
||||
"M-g g" 'avy-goto-line
|
||||
|
||||
;; window
|
||||
"M-<left>" 'shrink-window-horizontally
|
||||
"M-<right>" 'enlarge-window-horizontally
|
||||
"M-<down>" 'shrink-window
|
||||
"M-<up>" 'enlarge-window
|
||||
"M-`" 'popper-toggle
|
||||
"C-M-=" 'popper-toggle-type-delete-other-window
|
||||
"M-o" 'other-window
|
||||
"<f10>" 'esw/swap-two-windows
|
||||
|
||||
;; other
|
||||
"<mouse-3>" 'global-tab-line-mode)
|
||||
|
||||
;; expand region
|
||||
(setq expand-region-reset-fast-key "r")
|
||||
(setq expand-region-contract-fast-key "c")
|
||||
"M-o" 'other-window)
|
||||
|
||||
;; save-some-buffer时diff更改
|
||||
(add-to-list 'save-some-buffers-action-alist
|
||||
@@ -103,47 +76,6 @@
|
||||
(lambda (buffer) (diff-buffer-with-file (buffer-file-name buffer)))
|
||||
"show diff between the buffer and its file"))
|
||||
|
||||
;; 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 ()
|
||||
"
|
||||
^Mark^ ^Unmark^ ^Other^
|
||||
------------------------------------------------------------------
|
||||
_p_ : prev line _P_ : previous _c_ : edit lines
|
||||
_n_ : next line _N_ : next _._ : pop
|
||||
_b_ : prev word _q_ : quit
|
||||
_f_ : next word
|
||||
_B_ : prev symbol
|
||||
_F_ : next symbol
|
||||
_s_ : in region
|
||||
_a_ : all dwim
|
||||
"
|
||||
("p" mc/mark-previous-like-this)
|
||||
("n" mc/mark-next-like-this)
|
||||
("b" mc/mark-previous-like-this-word)
|
||||
("f" mc/mark-next-like-this-word)
|
||||
("B" mc/mark-previous-like-this-symbol)
|
||||
("F" mc/mark-next-like-this-symbol)
|
||||
("P" mc/unmark-previous-like-this)
|
||||
("N" mc/unmark-next-like-this)
|
||||
("a" mc/mark-all-dwim)
|
||||
("s" mc/mark-all-in-region)
|
||||
("c" mc/edit-lines)
|
||||
("." mc/mark-pop)
|
||||
("q" nil))
|
||||
|
||||
(provide 'init-terminal-kbd)
|
||||
|
||||
|
||||
@@ -4,19 +4,6 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; 安装gcmh用于管理内存回收
|
||||
(use-package gcmh
|
||||
:demand t
|
||||
:init
|
||||
(setq gcmh-idle-delay 'auto
|
||||
gcmh-auto-idle-delay-factor 10
|
||||
gcmh-high-cons-threshold #x4000000)
|
||||
:config
|
||||
(gcmh-mode 1))
|
||||
|
||||
;; 安装multiple-cursors
|
||||
(use-package multiple-cursors)
|
||||
|
||||
;; 安装crux,增强快捷键,快捷键配置在init-kbd.el中
|
||||
(use-package crux)
|
||||
|
||||
@@ -26,16 +13,19 @@
|
||||
;; 安装drag-stuff,拖动字符
|
||||
(use-package drag-stuff)
|
||||
|
||||
;; expand region
|
||||
(use-package expand-region)
|
||||
|
||||
;; 启用savehist,保存命令顺序
|
||||
(use-package savehist
|
||||
:init (setq enable-recursive-minibuffers t
|
||||
history-length 50
|
||||
savehist-additional-variables '(mark-ring
|
||||
global-mark-ring
|
||||
search-ring
|
||||
regexp-search-ring
|
||||
extended-command-history)
|
||||
savehist-autosave-interval 300)
|
||||
history-length 50
|
||||
savehist-additional-variables '(mark-ring
|
||||
global-mark-ring
|
||||
search-ring
|
||||
regexp-search-ring
|
||||
extended-command-history)
|
||||
savehist-autosave-interval 300)
|
||||
(savehist-mode))
|
||||
|
||||
;; saveplace,保存光标位置
|
||||
@@ -45,14 +35,24 @@
|
||||
;; undo增强
|
||||
(use-package undo-fu)
|
||||
|
||||
;; vundop,撤回树
|
||||
(use-package vundo
|
||||
:init (setq undo-limit 800000
|
||||
undo-strong-limit 1200000
|
||||
undo-outer-limit 12000000))
|
||||
;; vertico
|
||||
(use-package vertico
|
||||
:init (vertico-mode t))
|
||||
|
||||
;; expand-region,快速展开选中
|
||||
(use-package expand-region)
|
||||
;; 安装orderless,用于模糊搜索
|
||||
(use-package orderless
|
||||
:custom (completion-styles '(orderless basic)))
|
||||
|
||||
;; (use-package corfu-terminal
|
||||
;; :init (corfu-terminal-mode))
|
||||
|
||||
;; scheme
|
||||
(use-package geiser
|
||||
:config
|
||||
(with-eval-after-load 'geiser
|
||||
(setq geiser-default-implementation 'guile)))
|
||||
|
||||
(use-package geiser-guile)
|
||||
|
||||
;; general
|
||||
(use-package general)
|
||||
|
||||
71
lisp/init-terminal-startup.el
Normal file
71
lisp/init-terminal-startup.el
Normal file
@@ -0,0 +1,71 @@
|
||||
;;; init-const.el --- constant and system stuff -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defconst *is-mac* (eq system-type 'darwin))
|
||||
(defconst *is-linux* (eq system-type 'gnu/linux))
|
||||
(defconst *is-windows* (or (eq system-type 'ms-dos)
|
||||
(eq system-type 'windows-nt)))
|
||||
|
||||
(if *is-windows*
|
||||
(progn
|
||||
(set-language-environment "UTF-8")
|
||||
(prefer-coding-system 'utf-8)
|
||||
(set-default-coding-systems 'utf-8)
|
||||
(set-terminal-coding-system 'utf-8)
|
||||
(set-keyboard-coding-system 'utf-8)
|
||||
(setq default-buffer-file-coding-system 'utf-8)
|
||||
(setq default-process-coding-system '(utf-8 . utf-8))
|
||||
(setq w32-unicode-filenames t)
|
||||
(setq w32-system-coding-system 'utf-8)))
|
||||
|
||||
(setq backup-directory-alist
|
||||
`((".*" . ,(expand-file-name "backup/" user-emacs-directory)))
|
||||
backup-by-copying t
|
||||
delete-old-versions t
|
||||
kept-new-versions 6
|
||||
kept-old-versions 2
|
||||
version-control t)
|
||||
|
||||
(setq auto-save-file-name-transforms
|
||||
`((".*" ,(expand-file-name "auto-save-list/" user-emacs-directory) t)))
|
||||
|
||||
(put 'scroll-left 'disabled nil)
|
||||
|
||||
(setq create-lockfiles nil)
|
||||
|
||||
(setq ring-bell-function 'ignore)
|
||||
|
||||
(cond
|
||||
(*is-windows*
|
||||
(add-to-list 'exec-path (expand-file-name "H/appppppppppp/scoop/apps/"))
|
||||
(setenv "PATH" (concat (expand-file-name "H/appppppppppp/scoop/apps/") ";" (getenv "PATH"))))
|
||||
(*is-mac*
|
||||
(add-to-list 'exec-path (expand-file-name "/opt/homebrew/bin/"))
|
||||
(setenv "PATH" (concat (expand-file-name "/opt/homebrew/bin/") ":" (getenv "PATH")))))
|
||||
|
||||
|
||||
(global-auto-revert-mode 1)
|
||||
|
||||
(when (display-graphic-p)
|
||||
(recentf-mode)
|
||||
(setq recentf-max-saved-items 30)) ;; 最大保存数量
|
||||
|
||||
(delete-selection-mode)
|
||||
|
||||
(setq initial-scratch-message
|
||||
"")
|
||||
|
||||
(setq ibuffer-default-sorting-mode 'filename)
|
||||
|
||||
(setq native-comp-async-warnings-errors-kind 'silent)
|
||||
|
||||
(if (boundp 'use-short-answers)
|
||||
(setq use-short-answers t)
|
||||
(fset 'yes-or-no-p 'y-or-n-p))
|
||||
|
||||
(provide 'init-terminal-startup)
|
||||
|
||||
;;; init-terminal-statup.el ends here
|
||||
@@ -16,6 +16,9 @@
|
||||
(set-language-environment "UTF-8")
|
||||
(prefer-coding-system 'utf-8)))
|
||||
|
||||
;; 主题
|
||||
(load-theme 'tango-dark)
|
||||
|
||||
;; 显示文件大小
|
||||
(size-indication-mode t)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user