-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy-editing.el
64 lines (49 loc) · 2.21 KB
/
my-editing.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
;;; package -- Summary
;;; Define editing settings non specific to a language or filetype
;;; Commentary:
;;; Code:
;; disable auto-save and auto-backup
(setq auto-save-default nil)
(setq make-backup-files nil)
;; Pressing backspace during an Isearch will delete the previous
;; character typed (or do a reverse isearch if something matches the
;; current word). Without this, it will delete the highlighted text.
(define-key isearch-mode-map [backspace] 'isearch-delete-char)
;; Do not indent tabs
(setq indent-tabs-mode nil)
;; -- Cite: http://www.emacswiki.org/emacs/AutoIndentation#toc2 --
;; Autoindent newlines
(define-key global-map (kbd "RET") 'newline-and-indent)
;; Auto-indent pasted/yanked code
(dolist (command '(yank yank-pop))
(eval `(defadvice ,command (after indent-region activate)
(and (not current-prefix-arg)
(member major-mode '(emacs-lisp-mode lisp-mode
clojure-mode scheme-mode
haskell-mode ruby-mode
rspec-mode plain-tex-mode
c-mode c++-mode
objc-mode latex-mode))
(let ((mark-even-if-inactive transient-mark-mode))
(indent-region (region-beginning) (region-end) nil))))))
;; -- End Cite
;; Show matching paren (and change its color)
(show-paren-mode 1)
(require 'paren)
(set-face-background 'show-paren-match (face-background 'default))
(set-face-foreground 'show-paren-match "#def")
(set-face-attribute 'show-paren-match nil :weight 'extra-bold)
;; Delete any trailing whitespace before saving
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Comment blocks easily
(global-unset-key "\C-c\C-c")
(global-set-key "\C-c\C-c" 'comment-or-uncomment-region)
;; Use flycheck throughout all supported filetypes
(require 'flycheck)
(add-hook 'after-init-hook #'global-flycheck-mode)
;; Use autopair in all supported files
;; Temp disable since it's SLOW
;;(require 'autopair)
;;(autopair-global-mode)
(provide 'my-editing)
;;; my-editing.el ends here