.emacs.d

the most bloated Emacs config on this planet
git clone https://git.trogloxene.org/.emacs.d.git
Log | Files | Refs

init-edit.el (3231B)


      1 ;;; init-edit.el --- edit and navigate -*- lexical-binding: t -*-
      2 
      3 ;;; Commentary:
      4 
      5 ;;; Code:
      6 
      7 ;; delete select
      8 (use-package delsel
      9   :straight nil
     10   :hook
     11   (after-init . delete-selection-mode))
     12 
     13 ;; insert paris
     14 (use-package elec-pair
     15   :straight nil
     16   :config
     17   (setq electric-pair-inhibit-predicate 'electric-pair-conservative-inhibit))
     18 
     19 ;; subword movement
     20 (use-package subword
     21   :straight nil
     22   :delight
     23   :hook
     24   (after-init . global-subword-mode))
     25 
     26 ;; multiple cursors
     27 (use-package multiple-cursors
     28   :custom
     29   (mc/insert-numbers-default 1)
     30   (mc/always-run-for-all t)
     31   :init
     32   (setq mc/cmds-to-run-once
     33         '(god-mode-all
     34           hydra-multiple-cursors/body
     35           hydra-multiple-cursors/mc/edit-lines
     36           hydra-multiple-cursors/mc/insert-numbers
     37           hydra-multiple-cursors/mc/mark-all-dwim
     38           hydra-multiple-cursors/mc/mark-next-like-this
     39           hydra-multiple-cursors/mc/mark-next-like-this-symbol
     40           hydra-multiple-cursors/mc/mark-next-like-this-word
     41           hydra-multiple-cursors/mc/mark-previous-like-this
     42           hydra-multiple-cursors/mc/mark-previous-like-this-symbol
     43           hydra-multiple-cursors/mc/mark-previous-like-this-word
     44           hydra-multiple-cursors/mc/unmark-next-like-this
     45           hydra-multiple-cursors/mc/unmark-previous-like-this
     46           hydra-multiple-cursors/nil)))
     47 
     48 ;; useful commands
     49 (use-package crux)
     50 
     51 ;; hungry-delete
     52 (use-package hungry-delete)
     53 
     54 ;; drag-stuff
     55 (use-package drag-stuff)
     56 
     57 ;; better undo/redo
     58 (use-package undo-fu
     59   :config
     60   (setq undo-fu-allow-undo-in-region t))
     61 
     62 ;; save undo history across sessions
     63 (use-package undo-fu-session
     64   :hook
     65   (after-init . undo-fu-session-global-mode))
     66 
     67 ;; undo tree
     68 (use-package vundo
     69   :init
     70   (setq undo-limit 67108864
     71         undo-strong-limit 100663296
     72         undo-outer-limit 1006632960))
     73 
     74 ;; expand-region
     75 (use-package expand-region
     76   :commands
     77   (er/mark-symbol er/mark-word)
     78   :config
     79   (setq expand-region-smart-cursor t)
     80   (setq expand-region-reset-fast-key "r")
     81   (setq expand-region-contract-fast-key "c"))
     82 
     83 ;; Chinese support for avy
     84 (use-package ace-pinyin
     85   :delight
     86   :hook
     87   (after-init . ace-pinyin-global-mode))
     88 
     89 ;; avy-zap
     90 (use-package avy-zap)
     91 
     92 ;; faster replacement
     93 (use-package substitute)
     94 
     95 ;; modal editing
     96 (use-package god-mode
     97   :init
     98   (if *is-android* (add-hook 'after-init-hook 'god-mode-all))
     99   :config
    100   (unless (or *is-android* (not use-package-always-defer)) (which-key-enable-god-mode-support))
    101   (setq god-mode-enable-function-key-translation nil
    102         god-exempt-major-modes
    103         (cl-union '(diff-mode exwm-mode) god-exempt-major-modes :test 'equal)
    104         god-mode-lighter-string "THANK-GOD-MODE")
    105 
    106   (custom-set-faces '(god-mode-lighter ((t (:inherit error :weight bold)))))
    107 
    108   (defun my-sync-line-numbers-with-god-mode ()
    109     (let ((desired (if (and (bound-and-true-p god-local-mode) display-line-numbers-mode)
    110                        'relative
    111                      display-line-numbers-type)))
    112       (unless (or (eq display-line-numbers desired) (not display-line-numbers-mode))
    113         (setq display-line-numbers desired))))
    114   (add-hook 'post-command-hook #'my-sync-line-numbers-with-god-mode))
    115 
    116 (provide 'init-edit)
    117 ;;; init-edit.el ends here