blob: d33dac3e4f19789bd1ef69eaa4eb0d939198b827 (
plain)
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
|
;;; init-keybindings.el --- Global keybindings -*- lexical-binding: t; -*-
;; Copyright (C) 2026 Richard Qin
;; SPDX-License-Identifier: GPL-3.0-or-later
;; Author: Richard Qin
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Define personal commands and global keybindings.
;; Use C-c m as the prefix for custom commands.
;;; Code:
;; ------------------------------------------------------------
;; Personal commands
;; ------------------------------------------------------------
(defun my/open-init-file ()
"Open the main Emacs initialization file."
(interactive)
(find-file
(expand-file-name "init.el" user-emacs-directory)))
(defun my/open-config-directory ()
"Open the Emacs configuration directory in Dired."
(interactive)
(dired user-emacs-directory))
;; ------------------------------------------------------------
;; Personal keymap
;; ------------------------------------------------------------
(defvar my/command-map
(make-sparse-keymap)
"Keymap for personal Emacs commands.")
;; Register the personal command prefix.
(define-key global-map
(kbd "C-c m")
my/command-map)
;; ------------------------------------------------------------
;; Keybindings
;; ------------------------------------------------------------
(define-key my/command-map
(kbd "i")
#'my/open-init-file)
(define-key my/command-map
(kbd "d")
#'my/open-config-directory)
(define-key my/command-map
(kbd "r")
#'revert-buffer)
(define-key my/command-map
(kbd "w")
#'whitespace-mode)
(define-key my/command-map
(kbd "e")
#'eval-buffer)
(provide 'init-keybindings)
;;; init-keybindings.el ends here
|