-
Notifications
You must be signed in to change notification settings - Fork 1
/
.emacs
79 lines (59 loc) · 1.95 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
(require 'package)
;; todo
;;
;; - bind marks commands
(add-to-list
'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(package-initialize)
;; elpy
;; http://elpy.readthedocs.org/en/latest/concepts.html
;;
;; bindings:
;; - M-. jump-to-def
;; - M-* back from last jump to def
;; - C-c C-c send buffer to interpreter
;; Customize dired
(require 'dired-x)
(add-hook 'dired-mode-hook 'dired-hide-details-mode)
(setq-default dired-omit-files-p t)
(setq dired-omit-files (concat dired-omit-files "\\|^\\..+$" ".+\\.pyc"))
;; Bookmarks
(require 'bm)
(global-set-key (kbd "C-c b") 'bm-toggle)
(global-set-key (kbd "C-c n") 'bm-next)
;; Handy function for azoufzouf, insert yaz command character
(defun yaz ()
(interactive)
(insert "ⵣ"))
(global-set-key (kbd "C-x y") 'yaz)
(global-set-key (kbd "C-x C-r") 'ag-project)
(global-set-key (kbd "C-x r") 'ag)
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)
;; Pretty print xml
(defun bf-pretty-print-xml-region (begin end)
"Pretty format XML markup in region. You need to have nxml-mode
http://www.emacswiki.org/cgi-bin/wiki/NxmlMode installed to do
this. The function inserts linebreaks to separate tags that have
nothing but whitespace between them. It then indents the markup
by using nxml's indentation rules."
(interactive "r")
(save-excursion
(nxml-mode)
(goto-char begin)
(while (search-forward-regexp "\>[ \\t]*\<" nil t)
(backward-char) (insert "\n"))
(indent-region begin end))
(message "Ah, much better!"))
;; Compile buffer
;; accept ansi escape sequence in compile buffer
(require 'ansi-color)
(defun colorize-compilation-buffer ()
(toggle-read-only)
(ansi-color-apply-on-region (point-min) (point-max))
(toggle-read-only))
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)
(global-set-key (kbd "C-x C-g") 'compile)
(setq-default indent-tabs-mode nil)
;; replace "yes or no" question by "y or n"
(defalias 'yes-or-no-p 'y-or-n-p)