From d2b8f0cdf59e00e1e6d239fd08b2d3ae4d9a4455 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Thu, 29 Oct 2026 01:11:01 +0800 Subject: Configure Emacs core modules Signed-off-by: Richard Qin --- lisp/core/init-keybindings.el | 73 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 lisp/core/init-keybindings.el (limited to 'lisp/core/init-keybindings.el') 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 -- cgit v1.2.3