|  |  | ;; -*- lexical-binding: t -*-
 | 
						
						
						
							|  |  | (setq mac-option-modifier 'meta
 | 
						
						
						
							|  |  |       mac-command-modifier 'super)
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | (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") 'kill-region)          ; 对应Windows上面的Ctrol-x 剪切
 | 
						
						
						
							|  |  |  
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | (global-hl-line-mode 1)                            ; 高亮行号
 | 
						
						
						
							|  |  | (set-face-background 'hl-line "#e3f0fe")           ; 颜色
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | (setq default-frame-alist '((font . "霞鹜文楷等宽-20")))  ; 字体设置
 | 
						
						
						
							|  |  | (setq inhibit-startup-screen t)                    ; 关闭欢迎界面
 | 
						
						
						
							|  |  | (global-display-line-numbers-mode 1)               ; 设置行号
 | 
						
						
						
							|  |  | (electric-pair-mode t)                             ; 自动补全括号, 引号等
 | 
						
						
						
							|  |  | (tool-bar-mode 0)                                  ; 关闭界面菜单
 | 
						
						
						
							|  |  | (scroll-bar-mode 0)                                ; 关闭右侧滑动
 | 
						
						
						
							|  |  | (setq-default cursor-type '(bar . 4))              ; 设置光标样式
 | 
						
						
						
							|  |  | (setq make-backup-files nil)                       ; 不要设置~备份文件
 | 
						
						
						
							|  |  | (delete-selection-mode 1)                          ; 被选中的文字重新编辑允许直接覆盖
 | 
						
						
						
							|  |  | (global-auto-revert-mode 1)                        ; 外部如果更新了当前编辑的文本, em里面同步刷新
 | 
						
						
						
							|  |  | (fset 'yes-or-no-p 'y-or-n-p)                      ; 
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | ;(setq tab-always-indent 'complete)                 ; tab补全(界面有点乱, 不用了)
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | ;(require 'recentf)                                 ; 关闭文件后记录文件位置(好像没起作用)
 | 
						
						
						
							|  |  | ;(recentf-mode 1)
 | 
						
						
						
							|  |  | ;(setq recentf-max-menu-item 10)                    ; 保留历史位置的文件数目
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |  
 | 
						
						
						
							|  |  | ; 启动包管理器
 | 
						
						
						
							|  |  | (require 'package)
 | 
						
						
						
							|  |  | (setq package-archives '(("gnu"   . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
 | 
						
						
						
							|  |  |                           ("melpa" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")))
 | 
						
						
						
							|  |  | (package-initialize)
 | 
						
						
						
							|  |  | ;;防止反复调用 package-refresh-contents 会影响加载速度
 | 
						
						
						
							|  |  | (when (not package-archive-contents)
 | 
						
						
						
							|  |  |   (package-refresh-contents))
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | ;; 启动use package
 | 
						
						
						
							|  |  | (unless (package-installed-p 'use-package)
 | 
						
						
						
							|  |  |   (package-refresh-contents)
 | 
						
						
						
							|  |  |   (package-install 'use-package))
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | ;; 会在当前页显示一个buf进代码行提示
 | 
						
						
						
							|  |  | (use-package company
 | 
						
						
						
							|  |  |   :ensure t
 | 
						
						
						
							|  |  |   :defer t
 | 
						
						
						
							|  |  |   :init
 | 
						
						
						
							|  |  |   (global-company-mode 1)
 | 
						
						
						
							|  |  |   :config
 | 
						
						
						
							|  |  |   (setq company-minimum-prefix-length 2)
 | 
						
						
						
							|  |  |   (setq company-idle-delay 0.2)
 | 
						
						
						
							|  |  |   )
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | ;; 提示按下的按键和对应的函数
 | 
						
						
						
							|  |  | (use-package keycast
 | 
						
						
						
							|  |  |   :ensure t
 | 
						
						
						
							|  |  |   :defer t
 | 
						
						
						
							|  |  |   :init
 | 
						
						
						
							|  |  |   (keycast-mode-line-mode 1)
 | 
						
						
						
							|  |  |   :config
 | 
						
						
						
							|  |  |   )
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | ;; 对C M 相关的命令搜索提示
 | 
						
						
						
							|  |  | (use-package vertico
 | 
						
						
						
							|  |  |   :ensure t
 | 
						
						
						
							|  |  |   :defer t
 | 
						
						
						
							|  |  |   :init
 | 
						
						
						
							|  |  |   (vertico-mode t)
 | 
						
						
						
							|  |  |   :config
 | 
						
						
						
							|  |  |   )
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | ;; 模糊搜搜提示
 | 
						
						
						
							|  |  | (use-package orderless
 | 
						
						
						
							|  |  |   :ensure t
 | 
						
						
						
							|  |  |   :defer t
 | 
						
						
						
							|  |  |   :init
 | 
						
						
						
							|  |  |   (setq completion-styles '(orderless))
 | 
						
						
						
							|  |  |   :config
 | 
						
						
						
							|  |  |   )
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | ;; 直接显示粗略的帮助文档 用来配合vertico/orderless
 | 
						
						
						
							|  |  | (use-package marginalia
 | 
						
						
						
							|  |  |   :ensure t
 | 
						
						
						
							|  |  |   :defer t
 | 
						
						
						
							|  |  |   :init
 | 
						
						
						
							|  |  |   (marginalia-mode t)
 | 
						
						
						
							|  |  |   :config
 | 
						
						
						
							|  |  |   )
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | ;; 增强帮助和搜索
 | 
						
						
						
							|  |  | (use-package embark-consult
 | 
						
						
						
							|  |  |   :ensure t
 | 
						
						
						
							|  |  |   :defer t
 | 
						
						
						
							|  |  |   :bind((("C-;" . embark-act)     ;; 绑定 C-; 到 embark-act
 | 
						
						
						
							|  |  |    ("C-s" . consult-line)         ;; 将 C-s 绑定到 consult-line,用于文本搜索
 | 
						
						
						
							|  |  |    ("M-s i" . consult-imenu)      ;; M-s i 跳转到 consult-imenu,快速访问函数列表
 | 
						
						
						
							|  |  |    ("C-x b" . consult-buffer)     ;; C-x b 打开 consult-buffer,带历史记录的缓冲区列表
 | 
						
						
						
							|  |  |    ))
 | 
						
						
						
							|  |  |   :init
 | 
						
						
						
							|  |  |   (setq consult-async-min-input 2)
 | 
						
						
						
							|  |  |   :config
 | 
						
						
						
							|  |  |   (setq prefix-help-command 'embark-prefix-help-command)
 | 
						
						
						
							|  |  |   )
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | ;; 设置主题
 | 
						
						
						
							|  |  | (use-package catppuccin-theme
 | 
						
						
						
							|  |  |   :ensure t
 | 
						
						
						
							|  |  |   :defer t
 | 
						
						
						
							|  |  |   :init
 | 
						
						
						
							|  |  |   (setq catppuccin-flavor 'latte)
 | 
						
						
						
							|  |  |   (load-theme 'catppuccin :no-confirm)
 | 
						
						
						
							|  |  |   :config
 | 
						
						
						
							|  |  |   )
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | (setq a "~/.emacs.d/")
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | (defun say ())
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | 
 |