Files
tempo/init.el
e2hang 9b35fe0899 emacs
2025-12-22 15:15:47 +08:00

71 lines
2.2 KiB
EmacsLisp
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(require 'package)
;;
(setq package-archives '(("gnu" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
("nongnu" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/nongnu/")
("melpa" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")))
;;
(package-initialize)
;;
(unless package-archive-contents
(package-refresh-contents))
;;
(unless (package-installed-p 'company)
(package-install 'company))
;;
(add-hook 'after-init-hook 'global-company-mode)
;;
(setq company-minimum-prefix-length 5) ;
(setq company-idle-delay 0.0) ;
(setq company-show-quick-access t) ;
;; 1. 解决中文乱码问题(非常重要)
(set-language-environment "UTF-8")
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(modify-coding-system-alist 'process "*" 'utf-8)
;; 2. 设置默认字体(比如你喜欢的 Consolas
(set-face-attribute 'default nil :family "Consolas" :height 160)
;; 3. 关闭烦人的启动画面和工具栏
(setq inhibit-startup-screen t) ; 关闭启动画面
;;(tool-bar-mode -1) ; 关闭工具栏
;;(scroll-bar-mode -1) ; 关闭滚动条(看个人喜好)
;; 开启行号
(global-display-line-numbers-mode t)
;; 不开启eshell的
(add-hook 'eshell-mode-hook (lambda () (display-line-numbers-mode -1)))
;;自动匹配括号
(electric-pair-mode t)
;;任何模式下
(setq electric-pair-preserve-balance t)
;; 4. 快速打开配置文件(方便以后随时修改)
(defun open-init-file ()
(interactive)
(find-file "~/.emacs.d/init.el"))
(global-set-key (kbd "<f5>") 'open-init-file) ; 按 F5 快速改配置
(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 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.
)