-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-better-defaults.el
147 lines (100 loc) · 3.32 KB
/
init-better-defaults.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
145
;;; Code:
;;linux-better-defaults
(defun linux-better-defaults ()
;;chinese-pyim
(require 'chinese-pyim)
;; (require 'chinese-pyim-basedict)
;; (chinese-pyim-basedict-enable)
(require 'chinese-pyim-greatdict)
(chinese-pyim-greatdict-enable)
(setq default-input-method "chinese-pyim")
(global-set-key (kbd "C-\\") 'toggle-input-method))
(when (memq window-system '(x))
(linux-better-defaults))
;;mac-better-defaults
(defun mac-better-defaults ()
(setenv "PATH" (concat (getenv "PATH") ";\\usr\\local\\bin"))
(add-to-list 'exec-path "/usr/local/bin"))
(when (memq window-system '(ns))
(mac-better-defaults))
;;win32-better-defaults
(defun win32-better-defaults ()
(setenv "PATH" (concat (getenv "PATH") ";G:\\cygwin64\\bin"))
(add-to-list 'exec-path "G:/cygwin64/bin"))
(when (memq window-system '(w32))
(win32-better-defaults))
(desktop-save-mode t)
(setq make-backup-files nil)
;;(package-initialize)
(elpy-enable)
;;flycheck On-the-fly syntax checking
;;(require 'flycheck)
(global-flycheck-mode)
;;window-numbering:Change window by M+0..9
(window-numbering-mode t)
(setq window-numbering-assign-func
(lambda () (when (equal (buffer-name) "*Calculator*") 9)))
;;tab-with
(setq-default default-tab-width 4)
(setq-default tab-width 4)
(setq-default indent-tabs-mode t)
;;use shell easily on emacs
(add-to-list 'load-path "somewhere")
(require 'shell-pop)
;;set font height
;;(set-face-attribute 'default nil :height 110)
;;imenu-anywhere
;;(global-set-key (kbd "C-.")# 'imenu-anywhere)
;;(global-set-key (kbd "C-.") #'helm-imenu-anywhere)
;;(global-set-key (kbd "C-.") #'helm-imenu)
(global-set-key (kbd "C-.") #'popup-imenu)
;;imenu-list
(global-set-key (kbd "C-'") #'imenu-list-minor-mode)
;;revert-mode
(global-auto-revert-mode t)
;;projectile
;;(projectile-mode t)
(projectile-global-mode t)
;;helm-projectile
(require 'helm-projectile)
(helm-projectile-on)
;;helm-ag
(global-set-key (kbd "C-c f") 'helm-ag-project-root)
;;coding system
(when (memq window-system '(x, ns))
(setq buffer-file-coding-system 'utf-8)
(prefer-coding-system 'utf-8))
(when (memq window-system '(w32))
;; (set-language-environment 'Chinese-GBK)
;; (setq locale-coding-system 'gbk)
;; (set-default-coding-systems 'gbk)
;; (set-terminal-coding-system 'gbk)
;; (setq buffer-file-coding-system 'utf-8)
;; (prefer-coding-system 'utf-8)
;;work setting
(set-language-environment 'Chinese-GBK)
(modify-coding-system-alist 'file "\\.py\\'" 'gbk))
;;ring-bell-function
(setq ring-bell-function 'ignore)
;;Debug
(setq debug-on-error nil)
;;google-translate
(require 'google-translate)
(require 'google-translate-default-ui)
(global-set-key "\C-ct" 'google-translate-at-point)
(global-set-key "\C-cT" 'google-translate-query-translate)
(setq google-translate-default-target-language "zh-CN")
(setq google-translate-default-source-language "en")
;;buffer-move
;;(global-set-key (kbd "<C-S-up>") 'buf-move-up)
;;(global-set-key (kbd "<C-S-down>") 'buf-move-down)
;;(global-set-key (kbd "<C-S-left>") 'buf-move-left)
;;(global-set-key (kbd "<C-S-right>") 'buf-move-right)
;;switch-window
(global-set-key (kbd "C-x o") 'switch-window)
;;swap-buffers
(global-set-key (kbd "C-c b") 'swap-buffers)
;;change C-r the isearch-backward
(global-set-key (kbd "C-r") 'isearch-forward)
(require 'fill-column-indicator)
(provide 'init-better-defaults)