Kewei
首页·Home
留言·Message
关于·About
搜索
Emacs配置入门
2020年01月13日 04:24:21
395
0
0
文章分类:
Linux
目录 [TOC] 除非明确表明,默认使用的是MacOS/Linux系统。 ## 准备工作 #### 安装Emacs * MacOS用户:`brew install emacs` * Windows用户:直接[官网](https://www.gnu.org/software/emacs/)下载 * Ubuntu用户:`sudo apt install emacs` #### 修改.emacs文件 该文件一般位于用户的工作路径下面(`cd ~`),没有的话自己新建一个就好 添加以下两行到.emacs文件里 ```lisp (require 'package) (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) ``` ## Emacs + C/C++ 1. 安装clang(用于自动修正格式) `brew install clang`(`sudo apt install clang`) 新建.clang-format文件(用于配置代码格式) 我的配置:[clang-format](https://xkw168.github.io/files/clang-format) 2. 打开emacs,然后`M-x list-packages`,进入包安装界面,安装以下包 * clang-format * company * company-c-headers * company-rtags * flycheck-clang-… * flycheck-clang-… * flycheck-popup-tip * ggtags * popup-kill-ring 然后在.emacs里面配置这些包 我的配置:[emacs](https://xkw168.github.io/files/emacs) 还可以使用我写的这个自动化配置[脚本](https://github.com/xkw168/emacs/blob/master/c%2B%2B/setup.sh) ## Emacs + Python 安装以下包 - elpy - py-yapf 在你的.emacs里面添加以下代码 ```powershell ;; python mode (package-initialize) (elpy-enable) (add-hook 'python-mode-hook 'py-yapf-enable-on-save) ;; use yapf to format python file ``` ## Emacs + Verilog 安装以下包 - verilog-mode 在你的.emacs里面添加以下代码 ```powershell ;; Load verilog mode only when needed (autoload 'verilog-mode "verilog-mode" "Verilog mode" t ) ;; Any files that end in .v, .dv or .sv should be in verilog mode (add-to-list 'auto-mode-alist '("\\.[ds]?v\\'" . verilog-mode)) ;; Any files in verilog mode should have their keywords colorized (add-hook 'verilog-mode-hook '(lambda () (font-lock-mode 1))) (eval-after-load "align" '(add-to-list 'align-rules-list '(verilog-assignment (regexp . "\\(\\s-*\\)//") (mode . '(verilog-mode)) (repeat . nil)))) ``` ## Emacs + Java 未完待续
点赞
0
分享