-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy path.emacs
82 lines (70 loc) · 2.78 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
;; .emacs
;;; uncomment this line to disable loading of "default.el" at startup
;; (setq inhibit-default-init t)
;; turn on font-lock mode
(when (fboundp 'global-font-lock-mode)
(global-font-lock-mode t))
;; enable visual feedback on selections
;(setq transient-mark-mode t)
;; default to better frame titles
(setq frame-title-format
(concat "%b - emacs@" (system-name)))
;; default to unified diffs
(setq diff-switches "-u")
;; always end a file with a newline
;(setq require-final-newline 'query)
(setq-default make-backup-files nil)
(define-key ctl-x-map "l" 'goto-line)
(define-key ctl-x-map "r" 'replace-string)
(setq column-number-mode t)
;; set up unicode
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
;; This from a japanese individual. I hope it works.
(setq default-buffer-file-coding-system 'utf-8)
;; From Emacs wiki
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
(add-to-list 'load-path "/root/.emacs.d/auto-complete")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "/root/.emacs.d/auto-complete/ac-dict")
(ac-config-default)
(add-to-list 'load-path "~/.emacs.d/auto-complete-clang")
(require 'auto-complete-clang)
(setq ac-auto-start t)
(setq ac-quick-help-delay 0.5)
;; (ac-set-trigger-key "TAB")
;; (define-key ac-mode-map [(control tab)] 'auto-complete)
(define-key ac-mode-map [(control tab)] 'auto-complete)
(defun my-ac-config ()
(setq ac-clang-flags
(mapcar(lambda (item)(concat "-I" item))
(split-string
"
/usr/lib/gcc/armv6l-unknown-linux-gnueabihf/4.9.2/../../../../include/c++/4.9.2
/usr/lib/gcc/armv6l-unknown-linux-gnueabihf/4.9.2/../../../../include/c++/4.9.2/armv6l-unknown-linux-gnueabihf
/usr/lib/gcc/armv6l-unknown-linux-gnueabihf/4.9.2/../../../../include/c++/4.9.2/backward
/usr/lib/gcc/armv6l-unknown-linux-gnueabihf/4.9.2/include
/usr/local/include
/usr/lib/gcc/armv6l-unknown-linux-gnueabihf/4.9.2/include-fixed
/usr/include
")))
(setq-default ac-sources '(ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers))
(add-hook 'emacs-lisp-mode-hook 'ac-emacs-lisp-mode-setup)
;; (add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
(add-hook 'ruby-mode-hook 'ac-ruby-mode-setup)
(add-hook 'css-mode-hook 'ac-css-mode-setup)
(add-hook 'auto-complete-mode-hook 'ac-common-setup)
(global-auto-complete-mode t))
(defun my-ac-cc-mode-setup ()
(setq ac-sources (append '(ac-source-clang ac-source-yasnippet) ac-sources)))
(add-hook 'c-mode-common-hook 'my-ac-cc-mode-setup)
;; ac-source-gtags
(my-ac-config)
;; format code
(defun indent-buffer ()
"Indent the whole buffer."
(interactive)
(indent-region (point-min) (point-max) nil))
(global-set-key [f7] 'indent-buffer)