emacs的新配置

最近玩ubuntu感觉还可以,所以就还是转到了emacs下面,不过vim也用

再是因为有版本的更新呀,就把以前的配置都删了,重新开了配置emacs的坑。

26版本有点大,所以现在还是在用25版本,也开始用use-package来配置

因为是入门级使用,所以性能和别的都品不太出来,也是很简单的配置,真正的新手开坑

平台:win10 

版本:emacs-25.3

配置文件有两种方式:一种是用户目录下(C:\Users\*****)下的.emacs文件 , 一种是用户目录下appdata/roaming/.emacs.d/init.el

我用的是第二次方式,具体目录即:C:\Users\Instinct_EM\AppData\Roaming\.emacs.d\init.el

为了让配置文件和我安装的emacs(E:\emacs-25.3)在同一个文件中,所以要修改一下path和home

;;重定义emacs的路径
(setenv "HOME" "E:/emacs-25.3")
(setenv "PATH" "E:/emacs-25.3")


;;设置emacs的开始路径
(setq default-directory "~/")

;;emacs运行后将加载的初始化配置文件
(load-file "E:/emacs-25.3/.emacs.d/init.el")

这样一来,emacs的运行顺序就是先到C盘下的Roaming\.emacs.d\init.el,运行上面这一串指令,然后把自己的路径重导向E盘中的emacs-25.3\.emacs.d\这个路径下,再读取这个重导后的init.el配置

扫描二维码关注公众号,回复: 5716790 查看本文章

;;packages的加载要调用的函数,每次开启emacs时,都会增加一段,暂时没有想到解决方法,听说26版本取消了
(package-initialize)


;;将模块化后的几个文件加载到load-path中
(add-to-list 'load-path "~/.emacs.d/lisp/")

;;这个是用户的个人设置,比如对字体的一些设置,插件的一些微调会修改在lisp/custom.el这个文件中
(setq custom-file (expand-file-name "lisp/custom.el" user-emacs-directory))
(load-file custom-file)

;;依次导入插件包管理,界面管理和快捷键管理这三个模块
(require 'init-packages)
(require 'init-ui)
(require 'init-keybindings)

这个是在看了一点教学视频后学到的关于模块化管理插件的一些用法

在.emacs.d下面新建一个lisp文件夹,来进行一系列的模块划分

custom.el

(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.
 '(company-idle-delay 0.2)                           ;;company插件补全窗口的唤醒时间
 '(company-minimum-prefix-length 2)                  ;;company插件的触发长度 
 '(indent-tabs-mode nil)                             ;;关闭tab键的使用,在后面会替换成4个空格
 '(package-selected-packages (quote (company use-package hungry-delete)))   ;;这个是包的选择
 '(truncate-lines nil)                               ;;下面这三个是关于自动换行的问题,暂时没有好的解决方式
 '(truncate-partial-width-windows nil)
 '(word-wrap 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.
 )

猜你喜欢

转载自www.cnblogs.com/instinct-em/p/10628709.html