-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
81 lines (67 loc) · 2.63 KB
/
init.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
;; disable auto-save and auto-backup
;; (setq auto-save-default nil)
;; (setq make-backup-files nil)
;; store all backup and autosave files in the tmp dir
(setq backup-directory-alist
`((".*" . "/tmp/emacs.tmp")))
(setq auto-save-file-name-transforms
`((".*" "/tmp/emacs.tmp" t)))
;; remove trailing whitespace on save
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; add final newline on save
(setq require-final-newline t)
;; effective emacs http://steve.yegge.googlepages.com/effective-emacs
(global-set-key "\C-x\C-b" 'ibuffer)
(global-set-key "\C-x\C-m" 'execute-extended-command)
(global-set-key "\C-c\C-m" 'execute-extended-command)
(global-set-key "\C-w" 'backward-kill-word)
(global-set-key "\C-x\C-k" 'kill-region)
(global-set-key "\C-c\C-k" 'kill-region)
;; auto fill disable
(auto-fill-mode -1)
(set-default 'fill-column 200)
;; window movement
(global-set-key [S-left] 'windmove-left)
(global-set-key [S-right] 'windmove-right)
(global-set-key [S-up] 'windmove-up)
(global-set-key [S-down] 'windmove-down)
;;; Movement in iTerm2
(define-key input-decode-map "\e[1;5A" [C-up])
(define-key input-decode-map "\e[1;5B" [C-down])
(define-key input-decode-map "\e[1;5C" [C-right])
(define-key input-decode-map "\e[1;5D" [C-left])
;;; window control
(global-set-key "\M-1" 'delete-other-windows)
(global-set-key "\M-2" 'split-window-vertically)
(global-set-key "\M-3" 'split-window-horizontally)
(global-set-key "\M-0" 'delete-window)
;;; recent file
(require 'recentf)
(recentf-mode 1)
(defun recentf-ido-find-file ()
"Find a recent file using Ido."
(interactive)
(let* ((file-assoc-list
(mapcar (lambda (x) (cons (file-name-nondirectory x) x)) recentf-list))
(filename-list
(remove-duplicates (mapcar #'car file-assoc-list)
:test #'string=))
(filename (ido-completing-read "Choose recent file: "
filename-list
nil
t)))
(when filename
(find-file (cdr (assoc filename file-assoc-list))))))
(global-set-key "\C-xf" 'recentf-ido-find-file)
;;; dired
(setq dired-listing-switches "-alh")
;;; show line and column numbers
(line-number-mode 1)
(column-number-mode 1)
;; scroll one line at a time (less "jumpy" than defaults)
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(setq scroll-step 1) ;; keyboard scroll one line at a time
;;; disable bells completely
(setq ring-bell-function 'ignore)