emacs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. ;; Check that all packages are installed
  24. (ensure-package-installed
  25. 'iedit
  26. 'magit
  27. 'undo-tree
  28. 'evil
  29. 'evil-leader
  30. 'evil-tabs
  31. 'zenburn-theme
  32. 'powerline-evil
  33. )
  34. ;; Evil leader is Space
  35. (global-evil-leader-mode)
  36. (evil-leader/set-leader "<SPC>")
  37. ;; Evil tabs
  38. (global-evil-tabs-mode t)
  39. ;; Default to evil mode
  40. (require 'evil)
  41. (evil-mode t)
  42. ;; All yes or no prompts are y or n
  43. (defalias 'yes-or-no-p 'y-or-n-p)
  44. ;; Disable file backup
  45. (setq make-backup-files nil)
  46. ;; Save undo history under .emacs.d/undo
  47. (setq undo-tree-auto-save-history t
  48. undo-tree-history-directory-alist
  49. `(("." . ,(concat user-emacs-directory "undo"))))
  50. (unless (file-exists-p (concat user-emacs-directory "undo"))
  51. (make-directory (concat user-emacs-directory "undo")))
  52. ;; Delete info bindings for evil to take over
  53. (define-key Info-mode-map "g" nil)
  54. (define-key Info-mode-map "n" nil)
  55. (define-key Info-mode-map "p" nil)
  56. ;; Leave the clipboard alone
  57. (setq x-select-enable-clipboard nil)
  58. ;; Never follow symlinks
  59. (setq vc-follow-symlinks nil)
  60. ;; Save minibar history
  61. (savehist-mode 1)
  62. (setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring))
  63. ;; Powerline
  64. (require 'powerline)
  65. (powerline-vim-theme)
  66. ;; Recent Files
  67. (require 'recentf)
  68. (recentf-mode 1)
  69. (setq recentf-max-menu-items 25)
  70. (global-set-key "\C-x\ \C-r" 'recentf-open-files)
  71. ;; Leader keybinds
  72. (evil-leader/set-key
  73. "u" 'undo-tree-visualize
  74. "m" 'recentf-open-files)
  75. ;; TODO:
  76. ;; Go through the tutorials, skim the manuals
  77. ;; learning elisp
  78. ;; Fuzzy
  79. ;; Evil leader mode
  80. ;; Hotkey for undo tree
  81. ;; autocomplete
  82. ;; recent files
  83. ;; magit bindings
  84. (custom-set-variables
  85. ;; custom-set-variables was added by Custom.
  86. ;; If you edit it by hand, you could mess it up, so be careful.
  87. ;; Your init file should contain only one such instance.
  88. ;; If there is more than one, they won't work right.
  89. '(custom-enabled-themes (quote (zenburn)))
  90. '(custom-safe-themes
  91. (quote
  92. ("4e753673a37c71b07e3026be75dc6af3efbac5ce335f3707b7d6a110ecb636a3" default)))
  93. '(package-selected-packages
  94. (quote
  95. (evil-tabs powerline-evil zenburn-theme magit iedit evil-leader))))
  96. (custom-set-faces
  97. ;; custom-set-faces was added by Custom.
  98. ;; If you edit it by hand, you could mess it up, so be careful.
  99. ;; Your init file should contain only one such instance.
  100. ;; If there is more than one, they won't work right.
  101. )