-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_emacs
148 lines (118 loc) · 4.39 KB
/
dot_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
;;
;; NOTES:
;;
;; - To reload a file: M-x load-file
;; - To execute a sexp, move the point to the end of the sexp and press c-x c-e
;; - To see the value of a variable, move point on top of var, then: c-h v
;; - Rectangle mode:
;; replace contents of rect w/ string: c-x r t
;; - Start kbd macro: F3, stop macro: F4, playback: F4
;;
;; Turn off mouse interface early in startup to avoid momentary display
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
;; disable startup message
(setq inhibit-startup-message t)
(cond
((= 24 emacs-major-version)
;; evaluate version 24 code
;; Package manager stuff
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
))
(add-to-list 'load-path "~/.emacs.d/")
(when (require 'auto-complete-config nil 'noerror) ;; don't break if not installed
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(setq ac-comphist-file "~/.emacs.d/ac-comphist.dat")
(ac-config-default))
(setq jedi:setup-keys t)
(add-hook 'python-mode-hook 'jedi:setup)
(require 'jedi)
(require 'yasnippet)
(yas-global-mode 1)
;; Expand region
(require 'expand-region)
(global-set-key (kbd "C-\\") 'er/expand-region)
;; Multiple cursors
(require 'multiple-cursors)
(global-set-key (kbd "C-c r") 'mc/mark-all-in-region)
(global-set-key (kbd "C-c >") 'mc/mark-next-like-this)
(global-set-key (kbd "C-c <") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c a") 'mc/mark-all-like-this)
;; display time
(setq display-time-24hr-format t)
(display-time)
;; Bind C-x g to webjump
(global-set-key (kbd "C-x g") 'webjump)
;; Add Urban Dictionary to webjump
(eval-after-load "webjump"
'(add-to-list 'webjump-sites
'("Urban Dictionary" .
[simple-query
"www.urbandictionary.com"
"http://www.urbandictionary.com/define.php?term="
""])))
;; Save point position between sessions
(require 'saveplace)
(setq-default save-place t)
(setq save-place-file (expand-file-name ".places" user-emacs-directory))
;; Write backup files to their own directory
(setq backup-directory-alist
`(("." . ,(expand-file-name
(concat user-emacs-directory "backups")))))
;; Make backups of files, even when they're in version control
(setq vc-make-backup-files t)
;; Activate font-lock-mode (syntax coloring)
(global-font-lock-mode t)
;; Goto-line short-cut key
(global-set-key (kbd "C-x l") 'goto-line)
;; Remap the goto-line function to a function
;; that temporarily turns on line numbers.
(global-set-key [remap goto-line] 'goto-line-with-feedback)
;; Create a function to temporarily show line numbers
(defun goto-line-with-feedback ()
"Show line numbers temporarily, while prompting for the line number input"
(interactive)
(unwind-protect
(progn
(linum-mode 1)
(goto-line (read-number "Goto line: ")))
(linum-mode -1)))
;; parentheses highlighting
(show-paren-mode 1)
(setq blink-matching-paren t)
;; Show line number in the mode line
(line-number-mode 1)
;; Show column number in the mode line
(column-number-mode 1)
;; Set the fill column
(setq-default fill-column 72)
;; Indent size
(setq standard-indent 4)
;; Highlight the current line
(global-hl-line-mode 0)
;;
;; Emacs normally uses both tabs and spaces to indent lines. If you
;; prefer, all indentation can be made from spaces only. To request this,
;; set `indent-tabs-mode' to `nil'. This is a per-buffer variable;
;; altering the variable affects only the current buffer, but it can be
;; disabled for all buffers.
;;
;; Use (setq ...) to set value locally to a buffer
;; Use (setq-default ...) to set value globally
;;
(setq-default indent-tabs-mode nil)
;; ===== Turn on Auto Fill mode automatically in all modes =====
;; Auto-fill-mode causes the automatic wrapping of lines and insertion of
;; newlines when the cursor goes over the column limit.
;; This should actually turn on auto-fill-mode by default in all major
;; modes. The other way to do this is to turn on the fill for specific modes
;; via hooks.
(setq auto-fill-mode 1)
;; ===== Make Text mode the default mode for new buffers =====
(setq default-major-mode 'text-mode)