emacs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. (require 'package)
  2. (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
  3. (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
  4. (add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))
  5. (setq package-enable-at-startup nil)
  6. (package-initialize)
  7. (defun ensure-package-installed (&rest packages)
  8. "Assure every package is installed, ask for installation if it’s not.
  9. Return a list of installed packages or nil for every skipped package."
  10. (mapcar
  11. (lambda (package)
  12. (if (package-installed-p package)
  13. nil
  14. (if (y-or-n-p (format "Package %s is missing. Install it? " package))
  15. (package-install package)
  16. package)))
  17. packages))
  18. ;; make sure to have downloaded archive description.
  19. (or (file-exists-p package-user-dir)
  20. (package-refresh-contents))
  21. ;; Activate installed packages
  22. (package-initialize)
  23. ;; Assuming you wish to install "iedit" and "magit"
  24. (ensure-package-installed 'iedit
  25. 'magit
  26. 'undo-tree
  27. 'evil)
  28. ;; Default to evil mode
  29. (require 'evil)
  30. (evil-mode t)
  31. ;; All yes or no prompts are y or n
  32. (defalias 'yes-or-no-p 'y-or-n-p)
  33. ;; Disable file backup
  34. (setq make-backup-files nil)
  35. ;; Save undo history under .emacs.d/undo
  36. (setq undo-tree-auto-save-history t
  37. undo-tree-history-directory-alist
  38. `(("." . ,(concat user-emacs-directory "undo"))))
  39. (unless (file-exists-p (concat user-emacs-directory "undo"))
  40. (make-directory (concat user-emacs-directory "undo")))
  41. ;; TODO:
  42. ;; Evil leader mode
  43. ;; Hotkey for undo tree
  44. ;; autocomplete
  45. ;; recent files
  46. ;; magit bindings
  47. ;; learning elisp