-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsimple-init.el
133 lines (115 loc) · 3.84 KB
/
simple-init.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
;; ----------------------------
;; Completion
;; ----------------------------
(setq user-emacs-directory "~/.emacs.d.orig")
(defun dir-concat (dir file) (concat (file-name-as-directory dir)
file))
(push (dir-concat user-emacs-directory "plugins/") load-path)
(push (dir-concat user-emacs-directory "lisp/") load-path)
(add-to-list 'load-path "~/.emacs.d/lisp/")
(add-to-list 'load-path "~/.emacs.d/plugins/")
(add-to-list 'custom-theme-load-path "~/.emacs.d/elpa/atom-one-dark-theme-20190705.554/")
;(add-to-list 'load-path "~/.local/share/git/melpa/embark/")
;(require 'embark)
(require 'cl-seq)
(require 'setup-completion nil t)
(require 'setup-minibuffer nil t)
(when (require 'icomplete nil t)
(require 'setup-icomplete nil t)
(icomplete-mode 1))
;; ----------------------------
;; Windows
;; ----------------------------
(require 'setup-windows nil t)
(when (require 'popup-buffers nil t) (popup-buffers-mode 1))
(setq popup-buffers-reference-modes-list
(append my/help-modes-list
my/repl-modes-list
my/occur-grep-modes-list))
(setq popup-buffers-reference-buffer-list
'("^\\*Warnings\\*"
"^\\*Compile-Log\\*"
"^\\*Messages\\*"
"^\\*Backtrace\\*"
"^\\*evil-registers\\*"
"^\\*Apropos"
"^Calc:"
"^\\*ielm\\*"
"^\\*TeX Help\\*"
"\\*Shell Command Output\\*"
"\\*Async Shell Command\\*"
"\\*Completions\\*"
"Output\\*"
"\\*scratch\\*"))
;; ----------------------------
;; UI and stuff
;; ----------------------------
(scroll-bar-mode 0)
(tool-bar-mode 0)
(blink-cursor-mode 0)
(show-paren-mode 1)
(fset 'yes-or-no-p 'y-or-n-p)
(setq echo-keystrokes 0.01)
(file-name-shadow-mode 1)
(minibuffer-depth-indicate-mode 1)
(minibuffer-electric-default-mode 1)
;; ----------------------------
;; Editing
;; ----------------------------
(setq scroll-conservatively 1)
(setq scroll-preserve-screen-position t)
(electric-pair-mode 1)
(global-set-key (kbd "M-SPC")
(defun my/cycle-spacing-impatient (&optional n preserve-nl-back)
(interactive "*p")
(cycle-spacing (if (= n 1) -1 n) preserve-nl-back 'fast)))
(global-set-key (kbd "<C-M-backspace>") 'backward-kill-sexp)
(global-set-key
(kbd "C-w")
(defun backward-kill-word-or-region (&optional arg)
"Kill word backwards unless region is active,
kill region instead"
(interactive)
(if (region-active-p)
(kill-region (region-beginning)
(region-end))
(backward-kill-word (or arg 1)))))
(advice-add 'kill-ring-save :around
(defun kill-ring-save-advice (fun &rest args)
"Save line to kill ring if region is inactive"
(interactive)
(if mark-active
(funcall fun (region-beginning) (region-end))
(funcall fun (line-beginning-position)
(line-beginning-position 2)))))
(global-set-key (kbd "M-O") #'other-window)
(global-set-key (kbd "M-o") (defun open-line-above (&optional arg)
(interactive)
(beginning-of-line)
(open-line (or arg 1))
(indent-according-to-mode)))
(global-set-key (kbd "C-o") (defun open-line-below (&optional arg)
(interactive)
(end-of-line)
(open-line (or arg 1))
(forward-line)
(indent-according-to-mode)
))
(global-set-key (kbd "C-a")
(defun back-to-indentation-or-beginning () (interactive)
(if (= (point) (progn (back-to-indentation) (point)))
(beginning-of-line))))
;; Buffers
(when (require 'windmove nil t)
(windmove-default-keybindings))
(global-set-key (kbd "C-x k") #'kill-current-buffer)
;; Occur:
(define-key occur-mode-map "n" 'occur-next)
(define-key occur-mode-map "p" 'occur-prev)
;; History
(when (require 'savehist nil t)
(setq savehist-file (dir-concat user-cache-directory "savehist")
history-length 10000
history-delete-duplicates nil
savehist-save-minibuffer-history t)
(savehist-mode 1))