Files
.emacs.d/lisp/init-edit.el

148 lines
4.2 KiB
EmacsLisp
Raw Permalink Normal View History

2025-12-14 04:51:24 +11:00
;; -*- lexical-binding: t -*-
2026-03-20 22:04:25 +11:00
(use-package delsel
2026-04-02 19:21:30 +11:00
:ensure nil
:hook (elpaca-after-init . delete-selection-mode))
2026-03-20 22:04:25 +11:00
2026-04-03 00:22:19 +11:00
(use-package electric-pair-mode
:ensure nil
2026-04-10 18:21:13 +10:00
:hook elpaca-after-init
:config
(dolist (mode '(LaTeX-mode-hook org-mode-hook))
(add-hook mode
(lambda ()
(setq-local electric-pair-pairs
(append electric-pair-pairs '((?\\ . ?\\))))
(setq-local electric-pair-text-pairs electric-pair-pairs)))))
2026-03-29 19:12:45 +11:00
2026-04-08 15:25:39 +10:00
(use-package puni
:hook (elpaca-after-init . puni-global-mode)
2026-04-10 18:21:13 +10:00
:custom
(puni-confirm-when-delete-unbalanced-active-region nil)
2026-04-08 15:25:39 +10:00
:bind (:map puni-mode-map
("M-s" . puni-splice)
2026-04-10 18:21:13 +10:00
("DEL" . my-backspace)
("C-=" . puni-expand-region)
)
2026-04-08 15:25:39 +10:00
:init
(defun my-backspace ()
(interactive)
(if (looking-back (rx line-start (+ blank)))
(delete-region (line-beginning-position) (point))
(puni-backward-delete-char))))
2025-12-14 04:51:24 +11:00
2026-04-10 18:21:13 +10:00
;; (use-package combobulate
;; :ensure (:host github :repo "mickeynp/combobulate")
;; :hook prog-mode
;; :config
;; ;; You can customize Combobulate's key prefix here.
;; ;; Note that you may have to restart Emacs for this to take effect!
;; (setq combobulate-key-prefix "C-c o")
;; )
2026-02-28 19:27:53 +11:00
2026-02-25 22:12:47 +11:00
(use-package abbrev
2026-04-02 19:21:30 +11:00
:ensure nil
2026-03-29 19:12:45 +11:00
:diminish
2026-02-25 22:12:47 +11:00
:config
(setq-default abbrev-mode t)
(setq abbrev-file-name (expand-file-name "abbrev.el" user-emacs-directory)))
2025-12-16 08:23:57 +11:00
2025-12-22 10:51:46 +11:00
(use-package autorevert
2026-04-02 19:21:30 +11:00
:ensure nil
2025-12-22 10:51:46 +11:00
:diminish
2026-04-02 19:21:30 +11:00
:hook (elpaca-after-init . global-auto-revert-mode))
2025-12-22 10:51:46 +11:00
2026-03-20 22:04:25 +11:00
(use-package goto-addr
2026-04-02 19:21:30 +11:00
:ensure nil
2026-03-20 22:04:25 +11:00
:hook ((text-mode . goto-address-mode)
(prog-mode . goto-address-prog-mode)))
2026-04-08 15:25:39 +10:00
(use-package multiple-cursors
:hook elpaca-after-init
:bind (("C-S-c C-S-c" . mc/edit-lines)
("C->" . mc/mark-next-like-this)
("C-<" . mc/mark-previous-like-this)
("C-c C-<" . mc/mark-all-like-this)
("C-M->" . mc/skip-to-next-like-this)
("C-M-<" . mc/skip-to-previous-like-this)
("s-<mouse-1>" . mc/add-cursor-on-click)
("C-S-<mouse-1>" . mc/add-cursor-on-click)
:map mc/keymap
("C-|" . mc/vertical-align-with-space)))
2025-12-22 10:51:46 +11:00
2026-04-10 18:21:13 +10:00
;; (use-package expand-region
;; :bind ("C-=" . er/expand-region))
2025-12-14 04:51:24 +11:00
2025-12-22 12:30:25 +11:00
(use-package mwim
:bind (([remap move-beginning-of-line] . mwim-beginning)
([remap move-end-of-line] . mwim-end)))
2025-12-23 08:23:35 +11:00
(use-package avy
:bind
2026-03-20 22:04:25 +11:00
(("C-'" . avy-goto-char-timer))
:config
(setq avy-all-windows nil
avy-all-windows-alt t
avy-background t
avy-style 'pre))
;; Kill text between cursor and char
(use-package avy-zap
:bind (("M-z" . avy-zap-to-char-dwim)
("M-Z" . avy-zap-up-to-char-dwim)))
(use-package ace-pinyin
:diminish
2026-04-02 19:21:30 +11:00
:hook (elpaca-after-init . ace-pinyin-global-mode))
2026-03-20 22:04:25 +11:00
;; show number of matches
(use-package anzu
:diminish
:bind (([remap query-replace] . anzu-query-replace)
([remap query-replace-regexp] . anzu-query-replace-regexp)
:map isearch-mode-map
([remap isearch-query-replace] . anzu-isearch-query-replace)
([remap isearch-query-replace-regexp] . anzu-isearch-query-replace-regexp))
2026-04-02 19:21:30 +11:00
:hook (elpaca-after-init . global-anzu-mode))
2026-03-20 22:04:25 +11:00
;; Goto last change
(use-package goto-chg
:bind ("C-," . goto-last-change))
2025-12-23 08:23:35 +11:00
;; Treat undo history as a tree
(use-package vundo
:bind ("C-x u" . vundo)
:config (setq vundo-glyph-alist vundo-unicode-symbols))
2026-02-28 19:27:53 +11:00
;; Remember undo history
(use-package undo-fu-session
2026-04-02 19:21:30 +11:00
:hook (elpaca-after-init . undo-fu-session-global-mode))
2026-02-28 19:27:53 +11:00
2026-03-22 23:57:48 +11:00
;; Process
(use-package proced
2026-04-02 19:21:30 +11:00
:ensure nil
2026-03-22 23:57:48 +11:00
:init
(setq-default proced-format 'verbose)
(setq proced-auto-update-flag t
proced-auto-update-interval 3
proced-enable-color-flag t))
2026-02-21 08:47:38 +11:00
(use-package olivetti
:hook org-mode
2026-03-22 23:57:48 +11:00
:diminish
2026-04-05 21:31:02 +10:00
:bind (("<f7>" . olivetti-mode))
2026-02-21 08:47:38 +11:00
:custom
(olivetti-style 'fancy)
2026-02-22 05:24:39 +11:00
(olivetti-margin-width 5)
2026-04-10 18:21:13 +10:00
(olivetti-body-width 80))
2026-02-21 08:47:38 +11:00
2026-03-29 19:12:45 +11:00
(setq-default bidi-display-reordering 'left-to-right
bidi-paragraph-direction 'left-to-right
bidi-display-reordering nil)
(setq bidi-inhibit-bpa t
long-line-threshold 1000
large-hscroll-threshold 1000
syntax-wholeline-max 1000)
2025-12-14 04:51:24 +11:00
(provide 'init-edit)