-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
144 lines (120 loc) · 5.11 KB
/
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
134
135
136
137
138
139
140
141
142
143
144
(let ((default-directory "~/.emacs.d/lisp"))
(normal-top-level-add-to-load-path '("."))
(normal-top-level-add-subdirs-to-load-path))
(setq backup-directory-alist '((".*" . "~/.emacs.d/.temp")))
(package-initialize)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes '(tango-dark))
'(inhibit-startup-screen t)
'(package-selected-packages
'(apparmor-mode debian-el dpkg-dev-el bison-mode global-tags clang-format magit impatient-mode typescript-mode ggtags ztree))
'(standard-indent 2)
'(tab-always-indent nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;; (defun c-lineup-arglist-tabs-only (ignored)
;; "Line up argument lists by tabs, not spaces"
;; (let* ((anchor (c-langelem-pos c-syntactic-element))
;; (column (c-langelem-2nd-pos c-syntactic-element))
;; (offset (- (1+ column) anchor))
;; (steps (floor offset c-basic-offset)))
;; (* (max steps 1)
;; c-basic-offset)))
(add-hook 'c-mode-common-hook
(lambda ()
;; Add kernel style
(c-add-style
"linux-tabs-only"
'("linux" (c-offsets-alist
(arglist-cont-nonempty
c-lineup-gcc-asm-reg
c-lineup-arglist-tabs-only))))
(ggtags-mode 1)
))
;; (add-hook 'c-mode-hook
;; (lambda ()
;; (let ((filename (buffer-file-name)))
;; ;; Enable kernel mode for the appropriate files
;; (when (and filename
;; (string-match (expand-file-name "~/src/linux-trees")
;; filename))
;; (setq indent-tabs-mode t)
;; (setq show-trailing-whitespace t)
;; (c-set-style "linux-tabs-only")))))
(define-key global-map "\M-*" 'pop-tag-mark)
(autoload 'gtags-mode "gtags" "" t)
(setq gtags-mode-hook
'(lambda ()
(local-set-key "\M-t" 'gtags-find-tag)
(local-set-key "\M-r" 'gtags-find-rtag)
(local-set-key "\M-s" 'gtags-find-symbol)
(local-set-key "\C-t" 'gtags-pop-stack)
))
(setq c-basic-offset 8)
(setq c-default-style "linux")
(load "fill-column-indicator.el")
(load "frame-fns.el")
(load "frame-cmds.el")
(load "zoom-frm.el")
(load "flex.el")
(defun rename-current-buffer-file ()
"Renames current buffer and file it is visiting."
(interactive)
(let* ((name (buffer-name))
(filename (buffer-file-name))
(basename (file-name-nondirectory filename)))
(if (not (and filename (file-exists-p filename)))
(error "Buffer '%s' is not visiting a file!" name)
(let ((new-name (read-file-name "New name: " (file-name-directory filename) basename nil basename)))
(if (get-buffer new-name)
(error "A buffer named '%s' already exists!" new-name)
(rename-file filename new-name 1)
(rename-buffer new-name)
(set-visited-file-name new-name)
(set-buffer-modified-p nil)
(message "File '%s' successfully renamed to '%s'"
name (file-name-nondirectory new-name)))))))
;; key bindings
(global-set-key (kbd "<C-up>") 'shrink-window)
(global-set-key (kbd "<C-down>") 'enlarge-window)
(global-set-key (kbd "<C-left>") 'shrink-window-horizontally)
(global-set-key (kbd "<C-right>") 'enlarge-window-horizontally)
(global-set-key (kbd "C-x C-r") 'rename-current-buffer-file)
(if (display-graphic-p)
(progn
(global-set-key (vector (list 'control mouse-wheel-down-event)) 'zoom-frm-in)
(global-set-key (vector (list 'control mouse-wheel-up-event)) 'zoom-frm-out)
(global-set-key (kbd "C-c C-z") 'zoom-frm-unzoom)))
(when (>= emacs-major-version 24)
(require 'package)
(add-to-list
'package-archives
;; '("melpa" . "http://stable.melpa.org/packages/") ; many packages won't show if using stable
'("melpa" . "http://melpa.milkbox.net/packages/")
t))
(defun markdown-html (buffer)
(princ (with-current-buffer buffer
(format "<!DOCTYPE html><html><title>Impatient Markdown</title><xmp theme=\"united\" style=\"display:none;\"> %s </xmp><script src=\"http://strapdownjs.com/v/0.2/strapdown.js\"></script></html>" (buffer-substring-no-properties (point-min) (point-max))))
(current-buffer)))
(setq package-archives
'(("melpa" . "http://melpa.org/packages/")
("melpa-stable" . "http://stable.melpa.org/packages/")
("org-elpa" . "https://orgmode.org/elpa/")
("elpa" . "http://elpa.gnu.org/packages/")))
(delete-selection-mode 1)
(which-function-mode 1)
(show-paren-mode 1)
(defun insert-date ()
"Insert date at point." (interactive)
(insert (format-time-string "Week %U - %d/%m/%y")))
(setq scroll-step 1
scroll-conservatively 10000)
(require 'apparmor-mode)