-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-global-key-map.el
executable file
·79 lines (62 loc) · 2.3 KB
/
init-global-key-map.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
; unbind buffer menu popup
(global-set-key (kbd "C-<mouse-1>") nil)
(global-set-key (kbd "C-d") 'helm-M-x)
;; NOTE: "C-_" -> "ctrl+<backspace>" or "ctrl+/"
(global-set-key (kbd "C-<backspace>") 'backward-kill-word)
;; BEGIN unbind in all modes before cua-mode rebind
;; NOTE: if there is no selection, the line should be selected before running 'kill-ring-save ('copy')
;; TODO: check if 'kill-ring-save will work if the copied selection is alter, and if it copies to the clipboard on windows GUI Emacs, note that this is the desired behaviour
(global-set-key (kbd "C-c") nil) ; 'kill-ring-save
(global-set-key (kbd "C-v") nil) ; 'yank
;; END unbind in all modes before cua-mode rebind
; cua mode
(cua-mode t)
(setq cua-auto-tabify-rectangles nil) ;; Don't tabify after rectangle commands
(transient-mark-mode 1) ;; No region when it is not highlighted
(setq cua-keep-region-after-copy t) ;; Standard Windows behaviour
; (global-set-key (kbd "C-x") 'kill-region)
(global-set-key (kbd "C-z") 'undo) ; already bound with cua-mode
; (require 'redo) ; fails
; (global-set-key (kbd "C-y") 'redo) ; fails
; save
(global-set-key (kbd "C-s")
(lambda ()
(interactive)
(delete-trailing-whitespace)
; TODO: format code
(save-buffer)
)
)
(global-set-key (kbd "C-f") 'isearch-forward)
(global-set-key (kbd "C-w") 'delete-window)
(global-set-key (kbd "C-S-w") 'save-buffers-kill-emacs)
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
(global-set-key (kbd "<ESC>") 'keyboard-escape-quit)
(global-set-key (kbd "C-/") 'comment-or-uncomment-region)
; navigate windows
(global-set-key (kbd "M-<right>") 'windmove-right)
(global-set-key (kbd "M-<left>") 'windmove-left)
(global-set-key (kbd "M-<up>") 'windmove-up)
(global-set-key (kbd "M-<down>") 'windmove-down)
; mouse support in terminal
(unless window-system
(require 'mouse)
(xterm-mouse-mode t)
; TODO: fails
(global-set-key (kbd "<mouse-4>")
(lambda ()
(interactive)
(scroll-down 3)
)
)
; TODO: fails
(global-set-key (kbd "<mouse-5>")
(lambda ()
(interactive)
(scroll-up 3)
)
)
(defun track-mouse (e))
(setq mouse-sel-mode t)
)
(provide 'init-global-key-map)