支持自动安装包,适配python的emacs配置文件
;; ------------Emacs Custom Configuration----------
;; turn on highlight matching brackets when cursor is on one
(show-paren-mode 1)
(setq make-backup-files nil) ; stop creating backup~ files
;; (setq auto-save-default nil) ; stop creating #autosave# files
;; backup in one place. flat, no tree structure
(setq backup-directory-alist '(("" . "~/.emacs.d/emacs-backup")))
;; enable line numbers globally
(global-linum-mode t)
(setq linum-format "%4d ")
;; 切换到上一个buffer
;; (global-set-key (kbd "<f11>") 'previous-buffer)
;; 切换到下一个buffer
;; (global-set-key (kbd "<f12>") 'next-buffer)
;; 下一个窗口
(global-set-key (kbd "<f12>") 'other-window) ; 等价于C-x o
;; ------------------End---------------------------
;; ----------Emacs ELPA----------------------------
;; 要安装的包写在myPackages里面,会自动安装,melpa使用国内镜像
(when (>= emacs-major-version 24)
(require 'package)
(add-to-list
'package-archives
'("melpa" . "http://elpa.emacs-china.org/melpa/")
t)
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
(defvar myPackages
'(monokai-theme ; 主题
helm ;扩展M-x功能
elpy ;python模式
flycheck ;语法检测
neotree ;目录树
ido ;提供备选项
yagist ;支持gist
))
(mapc #'(lambda (package)
(unless (package-installed-p package)
(package-install package)))
myPackages)
)
;; ------------------End---------------------------
;; ------------------Package Customization---------
(load-theme 'monokai t)
(require 'helm-config)
(global-set-key (kbd "M-x") 'helm-M-x)
(elpy-enable)
(when (require 'flycheck nil t)
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode))
(require 'neotree)
(global-set-key [f9] 'neotree-toggle)
(require 'ido)
(ido-mode t)
(require 'yagist)
(setq yagist-github-token "***2aa19bf24ba91e330b7239c1512d7390e11bd")
;; ------------------End---------------------------
;; 后面的部分是自动添加的,如需修改配置文件,在这段话之前添加
网友评论