summaryrefslogtreecommitdiff
path: root/config.org
diff options
context:
space:
mode:
authorcashmere <cashmere@autistici.org>2026-08-11 19:58:55 +0200
committercashmere <cashmere@autistici.org>2026-08-11 19:58:55 +0200
commitef17a1971b70695f8b10b8ae4736be07d46c0974 (patch)
tree80b22b4e916b85031c43759b4839ea84d9e5472e /config.org
parente08aa0aa02efe771973a5eb0fdf6b77c3c7d29ad (diff)
downloademacs-ef17a1971b70695f8b10b8ae4736be07d46c0974.tar.gz
2026-08-11T19:59:00+02:00
Diffstat (limited to 'config.org')
-rw-r--r--config.org60
1 files changed, 51 insertions, 9 deletions
diff --git a/config.org b/config.org
index ad0204b..c83a3b2 100644
--- a/config.org
+++ b/config.org
@@ -337,6 +337,10 @@ Selects the compilation window so the cursor lands in it."
(defun my/helix-ignore-key ()
(interactive))
+(defconst my/helix-emacs-prefix-keys
+ (list ?\C-c ?\C-x)
+ "Prefix keys that should fall through to normal Emacs keymaps.")
+
(defun my/helix-make-fallback-keymap (block-characters)
(let ((keymap (make-keymap)))
(set-char-table-range
@@ -356,8 +360,15 @@ Selects the compilation window so the cursor lands in it."
(event-convert-list
(append modifiers (list character))))
#'my/helix-ignore-key)))
+ (dolist (key my/helix-emacs-prefix-keys)
+ (set-char-table-range (cadr keymap) key nil))
keymap))
+(defun my/helix-let-emacs-prefixes-through (&rest keymaps)
+ (dolist (keymap keymaps)
+ (dolist (key my/helix-emacs-prefix-keys)
+ (define-key keymap (vector key) nil))))
+
(defvar my/helix-normal-fallback-keymap
(my/helix-make-fallback-keymap t))
@@ -394,10 +405,19 @@ Selects the compilation window so the cursor lands in it."
my/helix-terminal-insert-state-keymap
(alist-get helix--current-state helix--state-to-keymap-alist)))
+(defvar my/helix-preserve-local-map-modes
+ '(magit-mode magit-section-mode magit-blame-read-only-mode)
+ "Modes whose local keymaps should stay behind Helix mode overrides.")
+
+(defun my/helix-preserve-local-map-p ()
+ (seq-some #'derived-mode-p my/helix-preserve-local-map-modes))
+
(defun my/helix-refresh-overriding-maps ()
(let* ((state helix--current-state)
(state-mode (alist-get state helix-state-mode-alist))
(base-keymap (my/helix-state-base-keymap))
+ (local-keymap (when (my/helix-preserve-local-map-p)
+ (current-local-map)))
overrides)
(dolist (priority '(4 3 2 1))
(let (matches)
@@ -412,9 +432,15 @@ Selects the compilation window so the cursor lands in it."
(push
(cons
state-mode
- (if overrides
- (make-composed-keymap overrides base-keymap)
- base-keymap))
+ (cond
+ ((and overrides local-keymap)
+ (make-composed-keymap overrides
+ (make-composed-keymap local-keymap base-keymap)))
+ (overrides
+ (make-composed-keymap overrides base-keymap))
+ (local-keymap
+ (make-composed-keymap local-keymap base-keymap))
+ (t base-keymap)))
minor-mode-overriding-map-alist)))
(defun my/helix-refresh-all-buffers ()
@@ -470,7 +496,8 @@ Selects the compilation window so the cursor lands in it."
'vterm-mode
'eat-mode
'eshell-mode
- 'shell-mode))
+ 'shell-mode
+ 'agent-shell-mode))
(defun my/helix-set-line-numbers (style)
(if (my/helix-line-numbers-disabled-p)
@@ -478,7 +505,7 @@ Selects the compilation window so the cursor lands in it."
(setq display-line-numbers style)))
(use-package helix
- :ensure nil
+ :ensure (:wait t)
:demand t
:hook ((helix-normal-mode . (lambda () (my/helix-set-line-numbers 'relative)))
(helix-insert-mode . (lambda () (my/helix-set-line-numbers t))))
@@ -504,6 +531,9 @@ Selects the compilation window so the cursor lands in it."
(my/helix-install-fallback-keymap
helix-insert-state-keymap
my/helix-insert-fallback-keymap)
+ (my/helix-let-emacs-prefixes-through
+ helix-normal-state-keymap
+ helix-insert-state-keymap)
(helix-define-key 'normal (kbd "C-u") #'my/helix-scroll-half-page-up)
(helix-define-key 'normal (kbd "C-d") #'my/helix-scroll-half-page-down)
(helix-define-key 'normal (kbd "C-i") #'xref-go-forward)
@@ -539,6 +569,7 @@ Selects the compilation window so the cursor lands in it."
(helix-define-key 'insert (kbd "C-x") #'completion-at-point)
(helix-define-key 'insert (kbd "C-r") #'insert-register)
(helix-define-key 'insert (kbd "M-x") #'helm-M-x)
+ (helix-define-key 'insert (kbd "M-SPC") 'helix-space-map)
(helix-define-key 'insert (kbd "C-w") #'backward-kill-word)
(helix-define-key 'insert (kbd "M-DEL") #'backward-kill-word)
(helix-define-key 'insert (kbd "M-d") #'kill-word)
@@ -569,12 +600,14 @@ Selects the compilation window so the cursor lands in it."
(helix-jj-setup 0.2))
(use-package embrace
+ :ensure (:wait t)
:defer t
:hook ((org-mode . embrace-org-mode-hook)
(emacs-lisp-mode . embrace-emacs-lisp-mode-hook))
:bind (("C-," . embrace-commander)))
(use-package multiple-cursors
+ :ensure (:wait t)
:defer t)
#+end_src
@@ -957,6 +990,8 @@ Selects the compilation window so the cursor lands in it."
("/" . isearch-forward)
("n" . isearch-repeat-forward)
("N" . isearch-repeat-backward)
+ ("RET" . magit-visit-thing)
+ ("<return>" . magit-visit-thing)
("q" . magit-mode-bury-buffer)
("S-SPC" . magit-diff-show-or-scroll-up)
("S-DEL" . magit-diff-show-or-scroll-down)
@@ -994,7 +1029,9 @@ Selects the compilation window so the cursor lands in it."
("[" . magit-section-backward-sibling)
("]" . magit-section-forward-sibling)
("TAB" . magit-section-toggle)
- ("S-TAB" . magit-section-cycle-global)))
+ ("<tab>" . magit-section-toggle)
+ ("S-TAB" . magit-section-cycle-global)
+ ("<backtab>" . magit-section-cycle-global)))
(helix-define-key
'normal
(kbd (car binding))
@@ -1944,6 +1981,7 @@ let's give agent-shell another try
(use-package agent-shell
:ensure t
+ :hook (agent-shell-mode . my/disable-line-numbers)
:config
(advice-add 'shell-maker-submit :after #'my/agent-shell-autoscroll)
(dolist (rule (my/agent-shell-display-buffer-rules))
@@ -1957,6 +1995,10 @@ let's give agent-shell another try
(setq agent-shell-activity-group-header-label-function
#'agent-shell-activity-group-descriptive-label)
+ (with-eval-after-load 'helix
+ (helix-define-key 'normal (kbd "RET") #'agent-shell-submit 'agent-shell-mode)
+ (helix-define-key 'normal (kbd "<return>") #'agent-shell-submit 'agent-shell-mode)
+ (my/helix-refresh-all-buffers))
;; Work around agent-shell's `window-system' guard so clipboard images
;; work in terminal Emacs (`emacs -nw'). The underlying save routine
@@ -2146,12 +2188,11 @@ automatically encrypted before save and can be decrypted in-place with
:demand t
:custom
(age-program "rage")
- (age-default-identity "~/.config/age/keys.txt")
+ (age-default-identity "~/.config/passage/identities")
(age-default-recipient
'("age188928acysrh9zpc3rk6q4lqmf3qlpjx3s26m6k3p6kah63gcws7sx3jeej"
"age1mhvdwh6cvd70hm5dcptc4xca2xnkf383g6706ful6kmrudwdysvq0eytym"))
:config
- (setenv "PINENTRY_PROGRAM" "pinentry-gnome3")
(setenv "PASSAGE_DIR" (expand-file-name "~/pass"))
(age-file-enable))
#+end_src
@@ -2205,7 +2246,8 @@ somehow passage depends on with-editor, don't ask me why.
:ensure (:wait t))
(use-package s
- :ensure (:wait t))
+ :ensure nil
+ :demand t)
(use-package with-editor
:ensure (:wait t))