Skip to content

Instantly share code, notes, and snippets.

@BeibinLi
Created June 1, 2017 23:55
Show Gist options
  • Save BeibinLi/13115e6a034c9c670c521f149b3894cc to your computer and use it in GitHub Desktop.
Save BeibinLi/13115e6a034c9c670c521f149b3894cc to your computer and use it in GitHub Desktop.
Emacs Configuration File
;; .emacs
;; Emacs Setting for Beibin Li
;; Date Modified: 05/31/2017
;;;;;;;;;;;;;;;;;;;;;;;;;; Package ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Add source to packages
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
;; Define packages needed1
(defvar myPackages
'(
better-defaults
ein
elpy ; python REPL
flycheck
monokai-theme ; theme
py-autopep8
ess ; for R
)
)
;; Install Missing packages
(mapc #'(lambda (package)
(unless (package-installed-p package)
(package-install package)))
myPackages)
;;;;;;;;;;;;;;;;;;;;;;;;;; Settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;; setting for Emacs
;; auto read file on disk if it is changed.
(global-auto-revert-mode t)
;; disable welcome screen
(setq inhibit-startup-screen t)
;; disable alarm sound
(setq ring-bell-function 'ignore)
;; enable line numbers globally
(global-linum-mode t)
;;;;;;;;;;;;;;;;;;;;;;;;;; setting for Packages
;; Evil mode for Vim keybindings
(require 'evil)
(evil-mode 1)
;; load material theme
(load-theme 'monokai t)
;; Python REPL supp
(elpy-enable)
(elpy-use-ipython)
;; use flycheck not flymake with elpy
(when (require 'flycheck nil t)
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode))
;; enable autopep8 formatting on save
(require 'py-autopep8)
(add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)
;;; Org Mode
(add-to-list 'load-path (expand-file-name "~/git/org-mode/lisp"))
(add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
(require 'org)
;;
;; Standard key bindings
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-iswitchb)
(setq org-long-done 'time) ; log time for todos
(setq org-log-done 'note) ; log note for todos
;;;;;;;;;;;;;;;;;;;;;;;;;; Defaults ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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
(org-cua-dwim py-autopep8 material-theme flycheck evil-visual-mark-mode elpy ein better-defaults))))
(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.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment