|
|
@ -8,11 +8,11 @@
|
|
|
|
(global-set-key (kbd "s-v") 'yank) ; 对应Windows上面的Ctrl-v 粘贴
|
|
|
|
(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-z") 'undo) ; 对应Windows上面的Ctrol-z 撤销
|
|
|
|
(global-set-key (kbd "s-x") 'kill-region) ; 对应Windows上面的Ctrol-x 剪切
|
|
|
|
(global-set-key (kbd "s-x") 'kill-region) ; 对应Windows上面的Ctrol-x 剪切
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(global-hl-line-mode 1) ; 高亮行号
|
|
|
|
|
|
|
|
(set-face-background 'hl-line "#e3f0fe") ; 颜色
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(set-default-coding-systems 'utf-8) ; 设置编码
|
|
|
|
|
|
|
|
(global-hl-line-mode 1) ; 高亮当前光标所在行
|
|
|
|
|
|
|
|
;;(set-face-background 'hl-line "#e3f0fe") ; 高亮行的颜色
|
|
|
|
(setq default-frame-alist '((font . "霞鹜文楷等宽-20"))) ; 字体设置
|
|
|
|
(setq default-frame-alist '((font . "霞鹜文楷等宽-20"))) ; 字体设置
|
|
|
|
(setq inhibit-startup-screen t) ; 关闭欢迎界面
|
|
|
|
(setq inhibit-startup-screen t) ; 关闭欢迎界面
|
|
|
|
(global-display-line-numbers-mode 1) ; 设置行号
|
|
|
|
(global-display-line-numbers-mode 1) ; 设置行号
|
|
|
@ -23,29 +23,17 @@
|
|
|
|
(setq make-backup-files nil) ; 不要设置~备份文件
|
|
|
|
(setq make-backup-files nil) ; 不要设置~备份文件
|
|
|
|
(delete-selection-mode 1) ; 被选中的文字重新编辑允许直接覆盖
|
|
|
|
(delete-selection-mode 1) ; 被选中的文字重新编辑允许直接覆盖
|
|
|
|
(global-auto-revert-mode 1) ; 外部如果更新了当前编辑的文本, em里面同步刷新
|
|
|
|
(global-auto-revert-mode 1) ; 外部如果更新了当前编辑的文本, em里面同步刷新
|
|
|
|
(fset 'yes-or-no-p 'y-or-n-p) ;
|
|
|
|
(fset 'yes-or-no-p 'y-or-n-p) ; 统一设置为 y/n
|
|
|
|
|
|
|
|
(auto-save-visited-mode 1) ; 设置自动保存
|
|
|
|
|
|
|
|
(setq auto-save-timeout 30) ; 设置自动保存时间间隔
|
|
|
|
|
|
|
|
(setq-default indent-tabs-mode nil) ; tab按键 使用空格代替制表符
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-package package
|
|
|
|
;(setq tab-always-indent 'complete) ; tab补全(界面有点乱, 不用了)
|
|
|
|
:config
|
|
|
|
|
|
|
|
(setq package-archives '(("gnu" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
|
|
|
|
;(require 'recentf) ; 关闭文件后记录文件位置(好像没起作用)
|
|
|
|
("melpa" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")))
|
|
|
|
;(recentf-mode 1)
|
|
|
|
(package-initialize)
|
|
|
|
;(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进代码行提示
|
|
|
|
;; 会在当前页显示一个buf进代码行提示
|
|
|
|
(use-package company
|
|
|
|
(use-package company
|
|
|
@ -56,9 +44,9 @@
|
|
|
|
:config
|
|
|
|
:config
|
|
|
|
(setq company-minimum-prefix-length 2)
|
|
|
|
(setq company-minimum-prefix-length 2)
|
|
|
|
(setq company-idle-delay 0.2)
|
|
|
|
(setq company-idle-delay 0.2)
|
|
|
|
|
|
|
|
:bind (:map company-active-map ("<tab>" . company-complete-selection)) ;; 强制强制替换company-complete-common
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; 提示按下的按键和对应的函数
|
|
|
|
;; 提示按下的按键和对应的函数
|
|
|
|
(use-package keycast
|
|
|
|
(use-package keycast
|
|
|
|
:ensure t
|
|
|
|
:ensure t
|
|
|
@ -86,7 +74,7 @@
|
|
|
|
:config
|
|
|
|
:config
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
;; 直接显示粗略的帮助文档 用来配合vertico/orderless
|
|
|
|
;; 直接显示粗略的帮助文档/注释 用来配合vertico/orderless
|
|
|
|
(use-package marginalia
|
|
|
|
(use-package marginalia
|
|
|
|
:ensure t
|
|
|
|
:ensure t
|
|
|
|
:defer t
|
|
|
|
:defer t
|
|
|
@ -99,11 +87,11 @@
|
|
|
|
(use-package embark-consult
|
|
|
|
(use-package embark-consult
|
|
|
|
:ensure t
|
|
|
|
:ensure t
|
|
|
|
:defer t
|
|
|
|
:defer t
|
|
|
|
:bind((("C-;" . embark-act) ;; 绑定 C-; 到 embark-act
|
|
|
|
:bind((("C-;" . embark-act) ;; 绑定 C-;(分号)到 embark-act
|
|
|
|
("C-s" . consult-line) ;; 将 C-s 绑定到 consult-line,用于文本搜索
|
|
|
|
("C-s" . consult-line) ;; 将 C-s 绑定到 consult-line,用于文本搜索
|
|
|
|
("M-s i" . consult-imenu) ;; M-s i 跳转到 consult-imenu,快速访问函数列表
|
|
|
|
("M-s i" . consult-imenu) ;; M-s i 跳转到 consult-imenu,快速访问函数列表
|
|
|
|
("C-x b" . consult-buffer) ;; C-x b 打开 consult-buffer,带历史记录的缓冲区列表
|
|
|
|
("C-x b" . consult-buffer) ;; C-x b 打开 consult-buffer,带历史记录的缓冲区列表
|
|
|
|
))
|
|
|
|
))
|
|
|
|
:init
|
|
|
|
:init
|
|
|
|
(setq consult-async-min-input 2)
|
|
|
|
(setq consult-async-min-input 2)
|
|
|
|
:config
|
|
|
|
:config
|
|
|
@ -120,6 +108,56 @@
|
|
|
|
:config
|
|
|
|
:config
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-package which-key
|
|
|
|
|
|
|
|
:ensure t
|
|
|
|
|
|
|
|
:init
|
|
|
|
|
|
|
|
(which-key-mode)
|
|
|
|
|
|
|
|
:config
|
|
|
|
|
|
|
|
(setq which-key-idle-delay 0.2) ;; 设置延迟时间,单位为秒,默认是1.5秒
|
|
|
|
|
|
|
|
(setq which-key-separator "→") ;; 设置快捷键间的分隔符
|
|
|
|
|
|
|
|
(setq which-key-suppress-keymap-warning t) ;; 不显示警告信息
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; 下面是内置的包不需要安装的
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; 保存命令历史/搜索历史/标记历史等信息
|
|
|
|
|
|
|
|
(use-package savehist
|
|
|
|
|
|
|
|
:ensure nil
|
|
|
|
|
|
|
|
:hook (after-init . savehist-mode)
|
|
|
|
|
|
|
|
:init (setq enable-recursive-minibuffers t ; Allow commands in minibuffers
|
|
|
|
|
|
|
|
history-length 3000
|
|
|
|
|
|
|
|
savehist-additional-variables '(mark-ring
|
|
|
|
|
|
|
|
global-mark-ring
|
|
|
|
|
|
|
|
search-ring
|
|
|
|
|
|
|
|
regexp-search-ring
|
|
|
|
|
|
|
|
extended-command-history)
|
|
|
|
|
|
|
|
savehist-autosave-interval 30)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; 每次离开缓冲区时记住光标的位置
|
|
|
|
|
|
|
|
(use-package saveplace
|
|
|
|
|
|
|
|
:ensure nil
|
|
|
|
|
|
|
|
:hook (after-init . save-place-mode)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; eglot
|
|
|
|
|
|
|
|
(use-package eglot
|
|
|
|
|
|
|
|
:ensure nil
|
|
|
|
|
|
|
|
:init
|
|
|
|
|
|
|
|
:config
|
|
|
|
|
|
|
|
(add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd"))
|
|
|
|
|
|
|
|
(setq c-basic-offset 4)
|
|
|
|
|
|
|
|
:hook
|
|
|
|
|
|
|
|
(c-mode . eglot-ensure)
|
|
|
|
|
|
|
|
(c++-mode . eglot-ensure)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(setq a "~/.emacs.d/")
|
|
|
|
(setq a "~/.emacs.d/")
|
|
|
|
|
|
|
|
|
|
|
|