我的emacs配置文件

Ra1ny House bio photo By Ra1ny House

支持自动安装包,适配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
    '(
      ;; spacemacs-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 'spacemacs-dark 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---------------------------
;; 后面的部分是自动添加的,如需修改配置文件,在这段话之前添加

(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 (quote (yagist neotree helm flycheck elpy))))
(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.
 )