-
Notifications
You must be signed in to change notification settings - Fork 0
/
.emacs
137 lines (108 loc) · 3.7 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
(setq user-full-name "Konstantin Golyaev")
(setq user-mail-address "kgolyaev@amazon.com")
;; mac - make sure command line is meta
(setq mac-option-key-is-meta nil)
(setq mac-command-key-is-meta t)
(setq mac-command-modifier 'meta)
(setq mac-option-modifier nil)
;; Setting up MELPA
(require 'package)
(load "package")
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/"))
(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)
;; so was this
(setq package-archive-enable-alist '(("melpa" deft magit)))
;; packages - this piece does not seem to work
;; startup options
(setq inhibit-splash-screen t
initial-scratch-message nil)
;; clipboard and such
(delete-selection-mode t)
(transient-mark-mode t)
(setq x-select-enable-clipboard t)
;; disable tabs
(setq tab-width 2
indent-tabs-mode nil)
;; abbreviate yes or no
(defalias 'yes-or-no-p 'y-or-n-p)
;; some key bindings
(global-set-key (kbd "RET") 'newline-and-indent)
(global-set-key (kbd "C-;") 'comment-or-uncomment-region)
(global-set-key (kbd "M-/") 'hippie-expand)
(global-set-key (kbd "C-+") 'text-scale-increase)
(global-set-key (kbd "C--") 'text-scale-decrease)
(global-set-key (kbd "C-c C-k") 'compile)
(global-set-key (kbd "C-x g") 'magit-status)
;; some more fun stuff
(setq echo-keystrokes 0.1
visible-bell t)
(show-paren-mode t)
;; bindings for smex
(setq smex-save-file (expand-file-name ".smex-items" user-emacs-directory))
(smex-initialize)
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
;; column number mode and line number
(setq column-number-mode t)
(setq global-linum-mode t)
;; auto-insert brace pair
(require 'autopair)
;; auto-complete
(require 'auto-complete-config)
(ac-config-default)
;; untabify and cleanup code
(defun untabify-buffer ()
(interactive)
(untabify (point-min) (point-max)))
(defun indent-buffer ()
(interactive)
(indent-region (point-min) (point-max)))
(defun cleanup-buffer ()
"Perform a bunch of operations on the whitespace content of a buffer."
(interactive)
(indent-buffer)
(untabify-buffer)
(delete-trailing-whitespace))
(defun cleanup-region (beg end)
"Remove tmux artifacts from region."
(interactive "r")
(dolist (re '("\\\\│\·*\n" "\W*│\·*"))
(replace-regexp re "" nil beg end)))
(global-set-key (kbd "C-x M-t") 'cleanup-region)
(global-set-key (kbd "C-c n") 'cleanup-buffer)
(setq-default show-trailing-whitespace nil)
;; added from prior configs
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
;; remap HOME and END keys to work as I expect them to
(define-key global-map [home] 'beginning-of-line)
(define-key global-map [end] 'end-of-line)
;; remap command and control functions in emacs
;;(setq mac-command-modifier 'control)
;;(setq mac-control-modifier 'meta)
;; tramp
(custom-set-variables
'(tramp-default-method "ssh")
'(tramp-password-prompt-regexp "^.*\\([pP]assword\\|passphrase\\|Response\\).*:\^@? *"))
(custom-set-faces)
;; added to avoid emacs droppings
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
;; delete into recycle bin
(setq delete-by-moving-to-trash t)
;; add recent files menu to emacs
(require 'recentf)
(recentf-mode 1)
;; English spell checker using Aspell
(setq-default ispell-program-name "C:/bin/Aspell/bin/aspell.exe")
(setq text-mode-hook '(lambda() (flyspell-mode t) ))
;; show column numbers as well
(setq column-number-mode t)