emacs24 plugins 配置
Posted 灬鬼谷灬
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了emacs24 plugins 配置相关的知识,希望对你有一定的参考价值。
Table of Contents
- 1. package-list install
- 2. ido(内置)
- 3. smex
- 4. expand-region
- 5. company-mode(可替代auto-complete)(通过插件安装)
- 6. YASnippet
- 7. ace-jump-mode
- 8. org-mode(内置模式)
- 9. Flaycheck 单纯的语法分析 (Flaymake (以编译方式检查文件))
- 10. electric-pair(内置功能)(auto-pair, smartparens)
1 package-list install
1.1 add to .emacs.d init.el
(when (>= emacs-major-version 24) (require 'package) (add-to-list 'package-archives '("melpa", "http://melpa.org/packages/") t) (package-initialize) )
2 ido(内置)
2.1 ido(interactively do)交互式工作,mini-buffer中,当输入一些字符,自动匹配当前目录合适的文件
(ido-mode t)
3 smex
3.1 给M-x后输入的命令带来了交互搜索的能力
;;; Smex (autoload 'smex "smex" "Smex is a M-x enhancement for Emacs, it provides a convenient interface to your recently and most frequently used commands.") (global-set-key (kbd "M-x") 'smex)
more information on https://www.emacswiki.org/emacs/Smex
4 expand-region
4.1 可将选择区域伸缩
;;expand-region (setq alphabet-start "abc def") (require 'expand-region) (global-set-key (kbd "C-=") 'er/expand-region)
5 company-mode(可替代auto-complete)(通过插件安装)
5.1 有一个漂亮的弹出菜单可以进行自动补全(不用再用M-/补全了)
;;company-mode ;;python company[jedi+company-jedi+ company] (require 'company) (defun my/python-mode-hook() (progn (company-mode) (add-to-list 'company-backends 'company-jedi) ) ) (add-hook 'python-mode-hook 'my/python-mode-hook) (add-hook 'python-mode-hook 'run-python-internal) ;;c++ company clang 才能正常运行 (add-hook 'c++-mode-hook 'company-mode)
6 YASnippet
6.1 方便自定义代码段的导入,一个TAB键就能扩展一段预先写好的代码(通过包管理器安装)
- 添加配置
;;yasnippet config (require 'yasnippet) (setq yas-snippet-dirs '("snippets")) (yas-global-mode t)
- 添加自定义模板
- M-x yes-new-snippet 创建新模板
- C-c C-c 保存
- snippet 的语法是从$符号开始的$1,$2…,来移动光标的位置,$0表示光标最后停止的位置,语法$n: default-value
7 ace-jump-mode
7.1 超级调转功能(通过包管理器安装)
(require 'ace-jump-mode) (define-key global-map (kbd "C-x C-j") 'ace-jump-mode)
8 org-mode(内置模式)
8.1 gdt、blog等功能
- M-x org-mode
9 Flaycheck 单纯的语法分析 (Flaymake (以编译方式检查文件))
9.1 一款神奇的语法检查器(通过插件包安装)
c++ 语法检查
;;flycheck (require 'flycheck) (add-hook 'c++-mode-hook (lambda()(progn (flycheck-mode) ;;disable clang check,gcc check works better (setq-default flycheck-disabled-checkers (append flycheck-disabled-checkers '(c/c++-clang))) (setq flycheck-gcc-language-standard "c++11") )))
python 语法检查
- sudo pip install pylint
- package-install RET flycheck
- emacs config
(defun flycheck-python-setup() (flycheck-mode)) (add-hook 'python-mode-hook #'flycheck-python-setup)
- pylint –generate-rcfile >.pylintrc
- set disable warnings and errors disable = c0326,w0621
10 electric-pair(内置功能)(auto-pair, smartparens)
10.1 自动括号匹配
(electric-pair-mode t) (show-paren-mode t);;打开括号匹配显示模式
11 安装 switch-window插件
11.1 快速切换window
(require 'switch-window) (global-set-key (kbd "C-x o") 'switch-window);;绑定快捷键
以上是关于emacs24 plugins 配置的主要内容,如果未能解决你的问题,请参考以下文章