-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.el
125 lines (99 loc) · 3.25 KB
/
main.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
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
;; remove {menu,tool}bar , display time using particular format
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(setq-default fill-column 72)
(setq auto-fill-mode 1)
(setq inhibit-startup-message t)
(setq column-number-mode t)
(setq line-number-mode t)
(defface my-display-time
'((((type x w32 mac))
(:foreground "pink" :background "black" : :inherit bold))
(((type tty))
(:foreground "blue")))
"Face used to display the time in the mode line.")
(setq display-time-string-forms
'((propertize (concat " " 24-hours ":" minutes " ")
'face 'my-display-time)))
(display-time)
(which-func-mode)
(require 'color-theme)
(require 'icicles)
(load-library "my-color-theme")
(global-font-lock-mode 1)
(color-theme-ryan)
;; visual editing
(transient-mark-mode t)
(show-paren-mode t)
(setq show-paren-style 'expression)
(global-font-lock-mode t) ;; automatic colorization
(blink-cursor-mode 0)
;; ido mode configuration
(ido-mode t)
(setq ido-enable-regexp t)
(setq ido-enable-flex-matching t)
(setq ido-execute-command-cache nil)
(ido-everywhere t)
(when (require 'recentf)
(setq recentf-auto-cleanup 'never) ;; évite de vérifier les fichiers distants au démarrage
(recentf-mode 1))
; elscreen is screen for emacs (the key is C-z)
(require 'elscreen)
;; globals keys and mouse config
(mouse-wheel-mode t)
(load-library "keys")
(require 'highlight-current-line)
(highlight-current-line-on t)
(load-library "coding")
(require 'yasnippet)
(yas/initialize)
(setq yas/root-directory '("~/etc/emacs/snippets"
"/usr/share/emacs/site-lisp/yasnippet/snippets/"))
(mapc 'yas/load-directory yas/root-directory)
(defun move-region (start end n)
"Move the current region up or down by N lines."
(interactive "r\np")
(let ((line-text (delete-and-extract-region start end)))
(forward-line n)
(let ((start (point)))
(insert line-text)
(setq deactivate-mark nil)
(set-mark start))))
(defun move-region-up (start end n)
"Move the current line up by N lines."
(interactive "r\np")
(move-region start end (if (null n) -1 (- n))))
(defun move-region-down (start end n)
"Move the current line down by N lines."
(interactive "r\np")
(move-region start end (if (null n) 1 n)))
(defun move-line (n)
"Move the current line up or down by N lines."
(interactive "p")
(setq col (current-column))
(beginning-of-line) (setq start (point))
(end-of-line) (forward-char) (setq end (point))
(let ((line-text (delete-and-extract-region start end)))
(forward-line n)
(insert line-text)
;; restore point to original column in moved line
(forward-line -1)
(forward-char col)))
(defun move-line-up (n)
"Move the current line up by N lines."
(interactive "p")
(move-line (if (null n) -1 (- n))))
(defun move-line-down (n)
"Move the current line down by N lines."
(interactive "p")
(move-line (if (null n) 1 n)))
(defun move-line-region-up (start end n)
(interactive "r\np")
(if (region-active-p) (move-region-up start end n) (move-line-up n)))
(defun move-line-region-down (start end n)
(interactive "r\np")
(if (region-active-p) (move-region-down start end n) (move-line-down n)))
(global-set-key [M-up] 'move-line-region-up)
(global-set-key [M-down] 'move-line-region-down)
(message "main is loaded")