diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-10-29 01:11:01 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-10-29 01:11:01 +0800 |
| commit | d2b8f0cdf59e00e1e6d239fd08b2d3ae4d9a4455 (patch) | |
| tree | 35b0ac8237bbea12799768613167cf87f3d26f41 /lisp/core/init-keybindings.el | |
| parent | ed2abc29486a9f5f4a9b76949ca3012f24a9bf69 (diff) | |
| download | emacs.d-d2b8f0cdf59e00e1e6d239fd08b2d3ae4d9a4455.tar.gz emacs.d-d2b8f0cdf59e00e1e6d239fd08b2d3ae4d9a4455.tar.xz | |
Configure Emacs core modules
Signed-off-by: Richard Qin <richard.qin.x@gmail.com>
Diffstat (limited to 'lisp/core/init-keybindings.el')
| -rw-r--r-- | lisp/core/init-keybindings.el | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/lisp/core/init-keybindings.el b/lisp/core/init-keybindings.el new file mode 100644 index 0000000..d33dac3 --- /dev/null +++ b/lisp/core/init-keybindings.el @@ -0,0 +1,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 |
