SHOW:
|
|
- or go back to the newest paste.
1 | (package-initialize) ;; Comes first | |
2 | ||
3 | (require 'package) | |
4 | ||
5 | (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos)) | |
6 | (not (gnutls-available-p)))) | |
7 | (proto (if no-ssl "http" "https"))) | |
8 | ||
9 | ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired | |
10 | (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t) | |
11 | ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t) | |
12 | (when (< emacs-major-version 24) | |
13 | ;; For important compatibility libraries like cl-lib | |
14 | (add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/"))))) | |
15 | ||
16 | ||
17 | ;; Automatically install use-package if not installed | |
18 | (unless (package-installed-p 'use-package) | |
19 | (package-refresh-contents) | |
20 | (package-install 'use-package)) | |
21 | ||
22 | ;; Calls use-package as compiled .elc | |
23 | (eval-when-compile | |
24 | (require 'use-package)) | |
25 | (use-package dashboard | |
26 | :config (dashboard-setup-startup-hook)) | |
27 | ||
28 | ;; Allow pasting selection outside of Emacs | |
29 | (setq x-select-enable-clipboard t) | |
30 | ||
31 | ;; Auto refresh buffers | |
32 | (global-auto-revert-mode 1) | |
33 | ||
34 | ;; Also auto refresh dired, but be quiet about it | |
35 | (setq global-auto-revert-non-file-buffers t) | |
36 | (setq auto-revert-verbose nil) | |
37 | ||
38 | ;; Show keystrokes in progress | |
39 | (setq echo-keystrokes 0.1) | |
40 | ||
41 | ;; Move files to trash when deleting | |
42 | (setq delete-by-moving-to-trash t) | |
43 | ||
44 | ;; Real emacs knights don't use shift to mark things | |
45 | (setq shift-select-mode nil) | |
46 | ||
47 | ;; Transparently open compressed files | |
48 | (auto-compression-mode t) | |
49 | ||
50 | ;; Enable syntax highlighting for older Emacsen that have it off | |
51 | (global-font-lock-mode t) | |
52 | ||
53 | ;; Answering just 'y' or 'n' will do | |
54 | (defalias 'yes-or-no-p 'y-or-n-p) | |
55 | ||
56 | ;; UTF-8 please | |
57 | (setq locale-coding-system 'utf-8) ; pretty | |
58 | (set-terminal-coding-system 'utf-8) ; pretty | |
59 | (set-keyboard-coding-system 'utf-8) ; pretty | |
60 | (set-selection-coding-system 'utf-8) ; please | |
61 | (prefer-coding-system 'utf-8) ; with sugar on top | |
62 | ||
63 | ;; Show active region | |
64 | (transient-mark-mode 1) | |
65 | (make-variable-buffer-local 'transient-mark-mode) | |
66 | (put 'transient-mark-mode 'permanent-local t) | |
67 | (setq-default transient-mark-mode t) | |
68 | ||
69 | ;; Remove text in active region if inserting text | |
70 | (delete-selection-mode 1) | |
71 | ||
72 | ;; Don't highlight matches with jump-char - it's distracting | |
73 | (setq jump-char-lazy-highlight-face nil) | |
74 | ||
75 | ;; Always display line and column numbers | |
76 | (setq line-number-mode t) | |
77 | (setq column-number-mode t) | |
78 | ||
79 | ;; Lines should be 80 characters wide, not 72 | |
80 | (setq fill-column 80) | |
81 | ||
82 | ;; Save a list of recent files visited. (open recent file with C-x f) | |
83 | (recentf-mode 1) | |
84 | (setq recentf-max-saved-items 100) ;; just 20 is too recent | |
85 | ||
86 | ;; Save minibuffer history | |
87 | (savehist-mode 1) | |
88 | (setq history-length 1000) | |
89 | ||
90 | ;; Undo/redo window configuration with C-c <left>/<right> | |
91 | (winner-mode 1) | |
92 | ||
93 | ;; Never insert tabs | |
94 | (set-default 'indent-tabs-mode nil) | |
95 | ||
96 | ;; Show me empty lines after buffer end | |
97 | (set-default 'indicate-empty-lines t) | |
98 | ||
99 | ;; Easily navigate sillycased words | |
100 | (global-subword-mode 1) | |
101 | ||
102 | ;; Don't break lines for me, please | |
103 | (setq-default truncate-lines t) | |
104 | ||
105 | ;; Keep cursor away from edges when scrolling up/down | |
106 | (require 'smooth-scrolling) | |
107 | ||
108 | ;; Allow recursive minibuffers | |
109 | (setq enable-recursive-minibuffers t) | |
110 | ||
111 | ;; Don't be so stingy on the memory, we have lots now. It's the distant future. | |
112 | (setq gc-cons-threshold 20000000) | |
113 | ||
114 | ;; org-mode: Don't ruin S-arrow to switch windows please (use M-+ and M-- instead to toggle) | |
115 | (setq org-replace-disputed-keys t) | |
116 | ||
117 | ;; Fontify org-mode code blocks | |
118 | (setq org-src-fontify-natively t) | |
119 | ||
120 | ;; Represent undo-history as an actual tree (visualize with C-x u) | |
121 | (setq undo-tree-mode-lighter "") | |
122 | (require 'undo-tree) | |
123 | (global-undo-tree-mode) | |
124 | ||
125 | ;; Sentences do not need double spaces to end. Period. | |
126 | (set-default 'sentence-end-double-space nil) | |
127 | ||
128 | ;; 80 chars is a good width. | |
129 | (set-default 'fill-column 80) | |
130 | ||
131 | ;; Add parts of each file's directory to the buffer name if not unique | |
132 | (require 'uniquify) | |
133 | (setq uniquify-buffer-name-style 'forward) | |
134 | ||
135 | ;; A saner ediff | |
136 | (setq ediff-diff-options "-w") | |
137 | (setq ediff-split-window-function 'split-window-horizontally) | |
138 | (setq ediff-window-setup-function 'ediff-setup-windows-plain) | |
139 | ||
140 | ;; No electric indent | |
141 | (setq electric-indent-mode nil) | |
142 | ||
143 | ;; Nic says eval-expression-print-level needs to be set to nil (turned off) so | |
144 | ;; that you can always see what's happening. | |
145 | (setq eval-expression-print-level nil) | |
146 | ||
147 | ;; When popping the mark, continue popping until the cursor actually moves | |
148 | ;; Also, if the last command was a copy - skip past all the expand-region cruft. | |
149 | (defadvice pop-to-mark-command (around ensure-new-position activate) | |
150 | (let ((p (point))) | |
151 | (when (eq last-command 'save-region-or-current-line) | |
152 | ad-do-it | |
153 | ad-do-it | |
154 | ad-do-it) | |
155 | (dotimes (i 10) | |
156 | (when (= p (point)) ad-do-it)))) | |
157 | ||
158 | (setq set-mark-command-repeat-pop t) | |
159 | ||
160 | ;; Offer to create parent directories if they do not exist | |
161 | ;; http://iqbalansari.github.io/blog/2014/12/07/automatically-create-parent-directories-on-visiting-a-new-file-in-emacs/ | |
162 | (defun my-create-non-existent-directory () | |
163 | (let ((parent-directory (file-name-directory buffer-file-name))) | |
164 | (when (and (not (file-exists-p parent-directory)) | |
165 | (y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory))) | |
166 | (make-directory parent-directory t)))) | |
167 | ||
168 | (add-to-list 'find-file-not-found-functions 'my-create-non-existent-directory) | |
169 | ||
170 | (provide 'sane-defaults) | |
171 | ||
172 | ||
173 | (use-package org | |
174 | :config | |
175 | (custom-set-faces | |
176 | ;; custom-set-faces was added by Custom. | |
177 | ;; If you edit it by hand, you could mess it up, so be careful. | |
178 | ;; Your init file should contain only one such instance. | |
179 | ;; If there is more than one, they won't work right. | |
180 | '(default ((t (:family "DejaVu Sans" :foundry "PfEd" :slant normal :weight normal :height 203 :width normal)))) | |
181 | '(org-agenda-done ((t nil))) | |
182 | '(org-done ((t (:foreground "cyan" :weight bold)))) | |
183 | '(org-todo ((t (:foreground "dark orange" :weight bold)))))) | |
184 | ||
185 | ||
186 | (use-package org-bullets | |
187 | :hook :hook (org-bullet . org-mode)) | |
188 | ||
189 | ||
190 | (custom-set-variables | |
191 | ;; custom-set-variables was added by Custom. | |
192 | ;; If you edit it by hand, you could mess it up, so be careful. | |
193 | ;; Your init file should contain only one such instance. | |
194 | ;; If there is more than one, they won't work right. | |
195 | '(custom-enabled-themes (quote (ahungry))) | |
196 | '(custom-safe-themes | |
197 | (quote | |
198 | ("20bf9f519f78b247da9ccf974c31d3537bee613ff11579f539b2781246dee73b" default)))) |