-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.emacs
154 lines (120 loc) · 4.57 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
; emacs init
;(require 'eldav)
(setq c-basic-offset 8)
(add-to-list 'load-path "~/.elisp")
(require 'writegood-mode)
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
(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.
'(font-lock-variable-name-face ((((type tty) (class color)) (:foreground "black" :weight normal)))))
(require 'xcscope)
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line
(require 'typescript)
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))
(require 'tss)
;; Key binding
(setq tss-popup-help-key "C-:")
(setq tss-jump-to-definition-key "C->")
(setq tss-implement-definition-key "C-c i")
;; Make config suit for you. About the config item, eval the following sexp.
;; (customize-group "tss")
;; Do setting recommemded configuration
(tss-config-default)
;
; C stuff
;
(setq-default comment-column 79)
(setq-default fill-column 79)
(setq tex-dvi-view-command "xdvi")
(setq tex-dvi-print-commnad "dvips")
;(define-key global-map "s-q" 'fill-paragraph)
(define-key global-map "\M-y" 'kill-ring-save)
(define-key global-map "\M-$" 'ispell-word)
(define-key global-map "\M-g" 'goto-line)
(define-key global-map "\M-f" 'what-line)
(define-key global-map "\C-w" 'copy-region-as-kill)
(define-key global-map "\M-w" 'kill-region)
(define-key global-map "\M-s" 'search-forward-regexp)
(define-key global-map "\M-z" 'repeat-complex-command)
(define-key global-map "\M-n" 'forward-word)
(global-set-key "\M-i" 'indent-region)
(global-set-key "\M-g" 'goto-line)
(global-set-key "\M-DEL" 'delete-region)
(line-number-mode 1)
(column-number-mode 1)
(global-set-key "[D" (quote backward-char))
(global-set-key "[C" (quote forward-char))
(global-set-key "[A" (quote previous-line))
(global-set-key "[b" (quote next-line))
(global-set-key "\M-s" (quote save-buffer))
(tool-bar-mode nil)
(menu-bar-mode nil)
;(load "desktop")
;(desktop-load-default)
;(desktop-read)
;(define-key c-mode-map "\^M" 'newline-and-indent)
(global-font-lock-mode t)
;(setq font-lock-support-mode 'lazy-lock-mode)
(setq font-lock-maximum-decoration t)
(add-hook 'c-mode-hook '(c-toggle-auto-hungry-state -1))
(add-hook 'latex-mode-hook 'writegood-mode)
(add-hook 'TeX-mode-hook 'writegood-mode)
(add-hook 'latex-mode-hook 'flyspell-mode)
(add-hook 'TeX-mode-hook 'flyspell-mode)
(add-hook 'latex-mode-hook 'flyspell-buffer)
(add-hook 'TeX-mode-hook 'flyspell-buffer)
(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.
'(package-selected-packages (quote (## markdown-mode tss))))
(tool-bar-mode -1)
(setq c-basic-offset 8
tab-width 8
indent-tabs-mode t)
(setq c-default-style "linux")
(line-number-mode 1)
(column-number-mode 1)
(setq standard-indent 8)
(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))))))
(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")))))
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/"))
(package-initialize)