-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.emacs
168 lines (140 loc) · 3.84 KB
/
.emacs
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
;; ~/.emacs
;; Most oftently changed setting
(normal-erase-is-backspace-mode 0)
;; Emacs23+
;(if (>= emacs-major-version 23) (server-start))
;; Author
;(setq user-full-name "User Name")
;(setq user-mail-address "[email protected]")
;; CustomConf & Autoload
(if (file-exists-p (expand-file-name "~/.emacs.local")) (load-file (expand-file-name "~/.emacs.local")))
(add-to-list 'load-path (expand-file-name "~/.config/emacs/el"))
;(require 'abbrevs nil 'noerror)
(require 'bindkeys nil 'noerror)
;(require 'compile-init nil 'noerror)
(require 'shebang nil 'noerror)
(require 'shell-interactions nil 'noerror)
(require 'templates nil 'noerror)
(require 'timestamp nil 'noerror)
(require 'auto-modes nil 'noerror)
;; Language
(prefer-coding-system 'utf-8)
(set-language-environment 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(setq locale-coding-system 'utf-8)
;; Interface
(setq inhibit-splash-screen t
initial-scratch-message nil
inhibit-startup-message t)
(menu-bar-mode -1)
(setq truncate-partial-width-windows nil)
(setq visible-bell t)
;(setq ring-bell-function (lambda() (call-process "artsplay" nil 0 nil "/path/to/audio/file"))
(setq line-number-mode t
column-number-mode t
linum-format "%\ 3d ")
(global-linum-mode t)
(setq display-time-format " %A %e %B %Y, %H:%M "
display-time-24hr-format t)
(display-time)
(setq-default show-trailing-whitespace t)
(setq european-calendar-style 't)
(setq calendar-week-start-day 1)
;TODO: disable mouse wheel scroll
(global-font-lock-mode t)
(show-paren-mode t)
(transient-mark-mode t)
(setq search-highlight t)
;(global-hl-line-mode t)
;; Edition
(setq scroll-step 1)
(delete-selection-mode t)
(setq mouse-yank-at-point t)
(and
(require 'centered-cursor-mode)
(global-centered-cursor-mode +1)
)
;(load "~/.emacs.d/centered-cursor-mode.el")
(setq auto-window-vscroll nil)
(setq backup-directory-alist '(("." . "/.config/emacs/.backup")))
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(setq next-line-add-newlines nil)
(setq default-major-mode 'text-mode)
(global-auto-revert-mode 1)
(setq x-select-enable-clipboard t)
;TODO: (shift-select-mode t)
;; Functions
(defun top-of-screen()
(interactive)
(forward-line (- (window-height) 2))
)
(defun bottom-of-screen()
(interactive)
(forward-line (- (- (window-height) 2)))
)
(defun clone-line()
(interactive)
(save-excursion
(beginning-of-line)
(let ((begin(point)))
(forward-line)
(copy-region-as-kill begin(point))
(yank)
(forward-line -1)
(back-to-indentation)
)
)
)
(defun kill-whole-line()
(interactive)
(save-excursion
(beginning-of-line)
(let ((begin(point)))
(forward-line)
(kill-region begin(point))
(forward-line -1)
(back-to-indentation)
)
)
)
(defun match-parenthesis(args)
(interactive "p")
(cond ((looking-at "\\s\(") (forward-list 1))
(t (backward-char 1)
(cond ((looking-at "\\s\)")
(forward-char 1) (backward-list 1))
(t (while (not (looking-at "\\s("))
(backward-char 1)
(cond ((looking-at "\\s\)")
(message "->> )")
(forward-char 1)
(backward-list 1)
(backward-char 1)
))
))
)
))
)
;; Fix
(add-hook 'before-save-hook (lambda ()
(when buffer-file-name
(let ((dir (file-name-directory buffer-file-name)))
(when (and (not (file-exists-p dir))
(y-or-n-p (format "Directory %s does not exist. Create it?" dir)))
(make-directory dir t)
))
)
)
)
(fset 'yes-or-no-p 'y-or-n-p)
(setq make-backup-files nil)
(setq confirm-kill-emacs nil)
(setq require-final-newline t)
(setq-default indent-tabs-mode nil)
(put 'overwrite-mode 'disabled t)
(put 'erase-buffer 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
;; EOF