;; -*- 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) ; 被选中的文字重新编辑允许直接覆盖 ;(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)) (package-install 'company) ; 会在当前页显示一个buf进代码行提示 (global-company-mode 1) (setq company-minimum-prefix-length 1) (setq company-idle-delay 0) (package-install 'keycast) ; 提示按下的按键和对应的函数 (keycast-mode-line-mode t) (package-install 'vertico) ; 对C M 相关的命令搜索提示 (vertico-mode t) (package-install 'orderless) ; 模糊搜搜提示 (setq completion-styles '(orderless)) (package-install 'marginalia) ; 直接显示粗略的帮助文档 用来配合vertico orderless (marginalia-mode t) (package-install 'embark-consult ) ; 增强帮助和搜索 (setq consult-async-min-input 2) ; 必须要输入两个中文/英文 字符才开始搜索 (global-set-key (kbd "C-;") 'embark-act) (setq prefix-help-command 'embark-prefix-help-command) (global-set-key (kbd "C-s") 'consult-line) ; 文本搜索 (global-set-key (kbd "M-s i") 'consult-imenu) ; 函数列表快速跳转 (global-set-key (kbd "C-x b") 'consult-buffer) ; 打开带有历史文件记录的buffer列表 ; 设置主题 (package-install 'catppuccin-theme) (load-theme 'catppuccin :no-confirm) (setq catppuccin-flavor 'latte) (catppuccin-reload) (setq a "~/.emacs.d/") (defun say ()) (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. '(package-selected-packages '(catppuccin-theme embark-consult embark consult company marginalia orderless vertico keycast))) (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. )