578 字
3 分钟
我的 Emacs 配置文件
前面字体设的是 Ubuntu Mono,没有的可以去Ubuntu里拷一份,字体放大了点。剩下的是一些基本的操作,可按需取用。
开启自动全屏、修改C-x、C-f默认位置仅适用于Windows系统。
下面是代码。
(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. '(display-time-mode t) '(show-paren-mode t) '(tool-bar-mode nil))(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. '(default ((t (:family "Ubuntu Mono" :foundry "outline" :slant normal :weight normal :height 143 :width normal)))))
;; 不显示工具栏(tool-bar-mode 0)
;; 不显示菜单栏(menu-bar-mode 0)
;光标改为竖线(setq-default cursor-type 'bar)
;; 高亮匹配括号。(show-paren-mode t)(setq show-paren-style 'parenthesis)
;; 撤销记录扩大。(setq-default kill-ring-max 65535)
;透明效果(set-frame-parameter (selected-frame) 'alpha (list 85 50))(add-to-list 'default-frame-alist (cons 'alpha (list 85 50)))
;一键Eshell(global-set-key (kbd "C-e") 'eshell)
;设置背景色(add-to-list 'default-frame-alist '(foreground-color . "#E0DFDB"))(add-to-list 'default-frame-alist '(background-color . "#000000"))
;取消欢迎屏幕(setq inhibit-splash-screen t)
;窗口最大化(仅在Windows 中有效)(run-with-idle-timer 0 nil 'w32-send-sys-command 61488)
;设置标题栏,我的设置为前面显示文档名,后面显示“ - Emacs”;放久了会还原,选中窗口即可,属正常现象(setq frame-title-format '("%b - Emacs"))
; 启用时间显示设置,在minibuffer上面的那个杠上(display-time-mode t)
;显示行号(global-linum-mode t)
;修改C-x、C-f默认位置 (仅针对Windows)(global-set-key (kbd "C-x C-f") (lambda () (interactive)(cd "d:\code")(call-interactively 'find-file)))考试的时候可以直接背下面这段:
(tool-bar-mode 0)(menu-bar-mode 0)(setq-default cursor-type 'bar)(show-paren-mode t)(setq show-paren-style 'parenthesis)(setq-default kill-ring-max 65535)(set-frame-parameter (selected-frame) 'alpha (list 85 50))(add-to-list 'default-frame-alist (cons 'alpha (list 85 50)))(global-set-key (kbd "C-e") 'eshell)(add-to-list 'default-frame-alist '(foreground-color . "#E0DFDB"))(add-to-list 'default-frame-alist '(background-color . "#000000"))(setq inhibit-splash-screen t)(setq frame-title-format '("%b - Emacs"))(display-time-mode t)(global-linum-mode t)附:
Windows 7及以上的系统配置文件放在C:\Users\(当前用户名)\AppData\Roaming\目录下,为一个.emacs文件。
Emacs 刚安装好的时候没有这个文件,又因为Windows 不能生成没有文件名的文件(.emacs的emacs是扩展名),所以可以通过先点Options->Set Default Fonts…->随便更改->Options->Save Options来生成.emacs文件。
Linux直接放主目录下,记得把显示隐藏文件打开。
我的 Emacs 配置文件
https://xn--24wq0n.top/posts/2021-03-05-我的_emacs_配置文件/