This repository was archived by the owner on Jan 21, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path+bindings.el
More file actions
117 lines (98 loc) · 3.93 KB
/
+bindings.el
File metadata and controls
117 lines (98 loc) · 3.93 KB
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
;;; +bindings.el -*- lexical-binding: t; -*-
;; Key binding guide
;; https://discourse.doomemacs.org/t/how-to-re-bind-keys/
;; NOTE: use `map!' macro for convienience
;;
;; Bind key onto Evil Normal state
;; (map! :after evil
;; :map evil-normal-state-map
;; "/" #'+default/search-buffer)
;; ------------------------------------------------
;; Key binding vars
;; fd as Esc key binding
;; https://discourse.doomemacs.org/t/typing-jk-deletes-j-and-returns-to-normal-mode/59/7
(after! evil-escape
(setq evil-escape-key-sequence "fd"))
;; https://discourse.doomemacs.org/t/what-are-leader-and-localleader-keys/153
;; Doom Defaults: `SPC' leader key, `SPC m' local leader
;; Practicalli: Set local leader to `,'
(setq doom-localleader-key ",")
;; ------------------------------------------------
;; ------------------------------------------------
;; Over-ride or add to Doom Emacs default key bindings
(map! :leader
"SPC" nil
:desc "M-x" "SPC" #'execute-extended-command)
;; Layout keys - disable `SPC TAB' workspace prefix
(map! :leader
(:prefix-map ("TAB" . nil))
(:prefix ("l". "Layouts")
:desc "Last Layout" "<tab>" #'+workspace/other
:desc "Display Tabs" "d" #'+workspace/display
:desc "Delete layout" "D" #'+workspace/delete
:desc "Layout list" "l" #'+workspace/switch-to
:desc "Load Layout" "L" #'+workspace/load
:desc "New Layout" "n" #'+workspace/new
:desc "Rename Layout" "r" #'+workspace/rename
:desc "Restore session" "R" #'+workspace/restore-last-session
:desc "Save Layout" "s" #'+workspace/save
:desc "Kill Session" "x" #'+workspace/kill-session
:desc "Switch to 0" "0" #'+workspace/switch-to-0
:desc "Switch to 1" "1" #'+workspace/switch-to-1
:desc "Switch to 2" "2" #'+workspace/switch-to-2
:desc "Switch to 3" "3" #'+workspace/switch-to-3
:desc "Switch to 4" "4" #'+workspace/switch-to-4
:desc "Switch to 5" "5" #'+workspace/switch-to-5
:desc "Switch to 6" "6" #'+workspace/switch-to-6
:desc "Switch to 7" "7" #'+workspace/switch-to-7
:desc "Switch to 8" "8" #'+workspace/switch-to-8
:desc "Switch to 9" "9" #'+workspace/switch-to-9))
;; Buffer customisations
(map! :leader
"TAB" nil
:desc "Last Buffer" "TAB" #'evil-switch-to-windows-last-buffer)
;; Replace Doom `/' highlight with buffer-search
(map! :after evil
:map evil-normal-state-map
"/" #'+default/search-buffer)
(map! :leader
(:prefix "b"
:desc "Dashboard" "h" #'+doom-dashboard/open
:desc "Toggle Last" "TAB" #'evil-switch-to-windows-last-buffer))
;; Treemacs
;; Toggle treemacs project browser from project menu
(map! :leader
(:prefix "p"
"t" nil ; disable project todos key binding
:desc "Project browser" "t" #'+treemacs/toggle))
;; Change SPC g s to call Magit Status, rather than stage hunk at point
(map! :leader
(:prefix "g"
:desc "" "s" nil ; remove existing binding
:desc "Magit Status" "s" #'magit-status))
;; Diff of files
(map! :leader
(:prefix "f"
:desc "" "d" nil ; remove existing binding
(:prefix ("d" . "diff")
:desc "3 files" "3" #'ediff3
:desc "ediff" "d" #'diff
:desc "ediff" "e" #'ediff
:desc "version" "r" #'vc-root-diff
:desc "version" "v" #'vc-ediff)))
;; Format
(map! :leader
(:prefix ("=" . "format")
:desc "buffer" "=" #'+format/buffer
:desc "buffer" "b" #'+format/buffer
:desc "region" "r" #'+format/region
:desc "whitespace" "w" #'delete-trailing-whitespace))
;; ------------------------------------------------
;; Experiments
;; Use `,,` to close a commit message and `,k' to cancel
;; Doom maps `ZZ` to commit, `ZQ' to quit
;; (map! :after magit
;; :map text-mode-map
;; :localleader
;; "," #'with-editor-finish
;; "k" #'with-editor-cancel)