commit 866329135c0f9d392f10d03134c545e2e5e6a331
parent 6353103c303259c2f4a105b1e30c993603d61918
Author: andsy10 <andsy1016@gmail.com>
Date: Tue, 4 Aug 2026 06:46:32 +0800
Clean up keybindings and remove unused features
Diffstat:
7 files changed, 28 insertions(+), 38 deletions(-)
diff --git a/lisp/init-edit.el b/lisp/init-edit.el
@@ -12,8 +12,7 @@
;; insert paris
(use-package elec-pair
:config
- (setq electric-pair-inhibit-predicate 'electric-pair-conservative-inhibit
- electric-pair-pairs (append '((?\= . ?\=)) electric-pair-pairs)))
+ (setq electric-pair-inhibit-predicate 'electric-pair-conservative-inhibit))
;; multiple cursors
(use-package multiple-cursors
@@ -97,9 +96,9 @@
(custom-set-faces '(god-mode-lighter ((t (:inherit error :weight bold)))))
(defun my-sync-line-numbers-with-god-mode ()
- (let ((desired (if (bound-and-true-p god-local-mode)
+ (let ((desired (if (and (bound-and-true-p god-local-mode) display-line-numbers-mode)
'relative
- t)))
+ display-line-numbers-type)))
(unless (or (eq display-line-numbers desired) (bound-and-true-p olivetti-mode))
(setq display-line-numbers desired))))
(add-hook 'post-command-hook #'my-sync-line-numbers-with-god-mode))
diff --git a/lisp/init-kbd-func.el b/lisp/init-kbd-func.el
@@ -20,6 +20,12 @@
(defun disable-truncate-lines ()
(toggle-truncate-lines 1))
+(defun query-replace-case-sensitive ()
+ "Case-sensitive `query-replace'."
+ (interactive)
+ (let ((case-fold-search nil))
+ (call-interactively #'query-replace)))
+
(defun my-jinx-smart-toggle ()
"Toggle jinx-mode smartly.
Disable jinx-mode if it's enable and global-jinx-mode is disable ,
@@ -99,7 +105,7 @@ otherwise toggle global-jinx-mode."
(denote-journal-select-file-prompt files))))
(defun my-denote-journal-open-entry ()
- "Open current denote-journal entry."
+ "Open current denote-journal entry if it exists."
(interactive)
(if (my-denote-journal-path-to-existing-entry)
(find-file (my-denote-journal-path-to-existing-entry))
@@ -257,7 +263,8 @@ argument)."
(defun my-pi-coding-agent ()
"Run `pi-coding-agent' in project root."
(interactive)
- (let ((default-directory (project-root (project-current t))))
+ (when-let* ((proj (project-current t))
+ (default-directory (project-root proj)))
(pi-coding-agent)))
(defun my-consult-git-grep-project ()
diff --git a/lisp/init-kbd.el b/lisp/init-kbd.el
@@ -110,6 +110,10 @@
"m" #'my-denote-open-metanote
"q" #'org-ql-search)
+(general-def
+ "C-c a" 'org-agenda
+ "C-c l" #'org-store-link)
+
;; j for journal
(general-def
:prefix "C-c j"
@@ -303,20 +307,6 @@
"P" #'eww-previous-url
"N" #'eww-next-url)
-;; global map with C-c prefix
-(general-def
- :prefix "C-c"
- "c" #'hydra-multiple-cursors/body
- "r" #'restart-emacs
- "e" #'er/expand-region
- "s" #'consult-line
- "a" #'org-agenda
- "l" #'org-store-link
- "k" #'comment-line
- "K" #'comment-kill
- "v" #'scroll-other-window
- "M-v" #'scroll-other-window-down)
-
;; global map
(general-def
@@ -352,7 +342,10 @@
"M-B" #'drag-stuff-left
"C-M-SPC" #'er/mark-symbol
"M-@" #'er/mark-word
+ "C-c e" #'er/expand-region
+ "C-c c" #'hydra-multiple-cursors/body
"C-S-<mouse-1>" #'mc/add-cursor-on-click
+ "C-x :" #'comment-kill
;; undo
"C-/" #'undo-fu-only-undo
@@ -360,12 +353,15 @@
"C-x u" #'vundo
;; navigate
+ "C-c v" #'scroll-other-window
+ "C-c M-v" #'scroll-other-window-down
"M-p" #'backward-paragraph
"M-n" #'forward-paragraph
"<mouse-2>" #'xref-find-definitions-at-mouse
"C-M-;" #'avy-goto-char
"C-M-'" #'avy-goto-word-1
"M-g g" #'avy-goto-line
+ "C-c s" #'consult-line
"M-g M-g" #'consult-goto-line
"M-g i" #'consult-imenu
"M-g I" #'consult-imenu-multi
@@ -398,11 +394,5 @@
(setq expand-region-reset-fast-key "r")
(setq expand-region-contract-fast-key "c")
-;; diff changes when saving buffers
-(add-to-list 'save-some-buffers-action-alist
- (list "d"
- (lambda (buffer) (diff-buffer-with-file (buffer-file-name buffer)))
- "show diff between the buffer and its file"))
-
(provide 'init-kbd)
;;; init-kbd.el ends here
diff --git a/lisp/init-package.el b/lisp/init-package.el
@@ -5,8 +5,7 @@
;;; Code:
;; keycast
-(if use-package-always-defer
- (use-package keycast))
+(use-package keycast)
;; display match count for isearch
(use-package anzu
diff --git a/lisp/init-startup.el b/lisp/init-startup.el
@@ -66,12 +66,6 @@
(setq initial-scratch-message
"")
-(defun my-scratch-set-mode (&rest _)
- (when (eq major-mode 'fundamental-mode)
- (funcall initial-major-mode)))
-
-(advice-add 'scratch-buffer :after #'my-scratch-set-mode)
-
;; frame title
(setq-default frame-title-format '("%b - Emacs"))
@@ -93,8 +87,9 @@
(setq-default indent-tabs-mode nil)
;; query gpg passphrase in minibuffer, needs to add
-;; 'allow-loopback-pinentry' to gpg-agent config
-(setq epg-pinentry-mode 'loopback)
+;; 'allow-loopback-pinentry' to gpg-agent config, comment it if you
+;; are using other pinentry programs
+;; (setq epg-pinentry-mode 'loopback)
;; secondary browser
(setq browse-url-secondary-browser-function 'eww)
diff --git a/lisp/init-terminal.el b/lisp/init-terminal.el
@@ -214,7 +214,7 @@
`(match ((t (:foreground ,base1 :background ,base02 :weight bold))))))
(progn
- (global-hl-line-mode nil)))
+ (global-hl-line-mode -1)))
(defun open-init-file()
"Open user's init.el file in ~/.emacs.d ."
diff --git a/lisp/init-ui.el b/lisp/init-ui.el
@@ -31,7 +31,7 @@
:hook
(after-init . global-display-line-numbers-mode)
:config
- (setq display-line-numbers-type '2
+ (setq display-line-numbers-type t
display-line-numbers-grow-only t
display-line-numbers-width-start 4))