summaryrefslogtreecommitdiff
path: root/.config/emacs/modules/mm-editing.el
diff options
context:
space:
mode:
Diffstat (limited to '.config/emacs/modules/mm-editing.el')
-rw-r--r--.config/emacs/modules/mm-editing.el106
1 files changed, 63 insertions, 43 deletions
diff --git a/.config/emacs/modules/mm-editing.el b/.config/emacs/modules/mm-editing.el
index 50a31c9..dda5352 100644
--- a/.config/emacs/modules/mm-editing.el
+++ b/.config/emacs/modules/mm-editing.el
@@ -24,18 +24,20 @@
(dolist (command #'(align-region
c-backslash-region
comment-dwim
- makefile-backslash-region))
+ makefile-backslash-region
+ sh-backslash-region))
(advice-add command :around #'mm-editing-force-space-indentation))
;;; Recenter The Screen When Jumping
-(dolist (command #'(backward-page
- backward-paragraph
- forward-page
- forward-paragraph
- pop-global-mark))
- (advice-add command :around #'mm-do-and-center))
+(mm-comment
+ (dolist (command #'(backward-page
+ backward-paragraph
+ forward-page
+ forward-paragraph
+ pop-global-mark))
+ (advice-add command :around #'mm-do-and-center)))
;;; Indentation Settings
@@ -45,7 +47,8 @@
indent-tabs-mode (not mm-humanwave-p))
(defvar mm-editing-indentation-settings-alist
- '((c-mode . (:extras c-basic-offset))
+ '((awk-ts-mode . (:extras awk-ts-mode-indent-level))
+ (c-mode . (:extras c-basic-offset))
(c-ts-mode . (:extras c-ts-mode-indent-offset))
(css-mode . (:extras css-indent-offset))
(emacs-lisp-mode . (:width 8 :spaces t)) ; GNU code uses 8-column tabs
@@ -150,7 +153,6 @@ region are marked, otherwise all matches in the buffer are marked."
(or (use-region-end) (point-max))
(read-string
(format-prompt ,(concat "Match " noun) nil))))
- (require 'multiple-cursors)
(if (string-empty-p ,noun-symbol)
(message "Command aborted")
(catch 'mm--no-match
@@ -177,47 +179,51 @@ region are marked, otherwise all matches in the buffer are marked."
(mm--define-mc-marking-command
mm-mark-all-in-region-regexp re-search-forward "regexp")
-(defun mm-silent-mc-load (args)
- "Advice to `load' to force it to be silent. The `multiple-cursors'
-package loads an `.mc-lists.el' file without passing `:nomessage' which
-causes messages to be sent in the minibuffer and *Messages* buffer. This
-forces that to not happen."
- (when (and (boundp 'mc/list-file)
- (string= (car args) mc/list-file))
- (pcase (length args)
- (1 (setq args (list (car args) nil :nomessage)))
- (2 (add-to-list 'args :nomessage :append))
- (_ (setf (caddr args) :nomessage)))
- (advice-remove #'load #'mm-silent-mc-load))
- args)
+(mm-comment
+ (defun mm-silent-mc-load (args)
+ "Advice to `load' to force it to be silent.
+The `multiple-cursors' package loads an `.mc-lists.el' file without
+passing `:nomessage' which causes messages to be sent in the minibuffer
+and *Messages* buffer. This forces that to not happen."
+ (when (and (boundp 'mc/list-file)
+ (string= (file-truename (car args))
+ (file-truename mc/list-file)))
+ (pcase (length args)
+ (1 (setq args (list (car args) nil :nomessage)))
+ (2 (add-to-list 'args :nomessage :append))
+ (_ (setf (caddr args) :nomessage)))
+ (advice-remove #'load #'mm-silent-mc-load))
+ args))
(use-package multiple-cursors
:ensure t
- :defer 2
:bind (("C->" . #'mc/mark-next-like-this)
("C-<" . #'mc/mark-previous-like-this)
("C-M-<" . #'mc/mark-all-like-this-dwim)
("C-M->" . #'mc/edit-lines)
- ("C-$" . #'mm-mark-all-in-region)
+ :map search-map
+ ("$" . #'mm-mark-all-in-region)
("M-$" . #'mm-mark-all-in-region-regexp))
+ :commands ( mm-mark-all-in-region mm-mark-all-in-region-regexp
+ mm-add-cursor-to-next-thing mm-transpose-cursor-regions)
:init
- (advice-add #'load :filter-args #'mm-silent-mc-load)
+ (mm-comment
+ (advice-add #'load :filter-args #'mm-silent-mc-load)
+ (with-eval-after-load 'multiple-cursors-core
+ (dolist (command #'(backward-delete-char
+ capitalize-dwim
+ delete-backward-char
+ delete-forward-char
+ downcase-dwim
+ upcase-dwim))
+ (add-to-list 'mc/cmds-to-run-for-all command))
+ (dolist (command #'(helpful-callable
+ helpful-key
+ helpful-symbol
+ helpful-variable))
+ (add-to-list 'mc/cmds-to-run-once command))))
(with-eval-after-load 'multiple-cursors-core
- (dolist (command #'(backward-delete-char
- capitalize-dwim
- delete-backward-char
- delete-forward-char
- downcase-dwim
- upcase-dwim))
- (add-to-list 'mc/cmds-to-run-for-all command))
- (dolist (command #'(helpful-callable
- helpful-key
- helpful-symbol
- helpful-variable))
- (add-to-list 'mc/cmds-to-run-once command))
- (add-to-list 'mc/unsupported-minor-modes #'corfu-mode))
- :config
- (keymap-unset mc/keymap "<return>" :remove))
+ (keymap-unset mc/keymap "<return>" :remove)))
;;; Increment Numbers
@@ -304,11 +310,25 @@ is as described by `emmet-expand-line'."
(emmet-self-closing-tag-style ""))
+;;; Number Formatting
+
+(use-package number-format-mode
+ :commands ( number-format-buffer number-format-region
+ number-unformat-buffer number-unformat-region
+ number-format-mode))
+
+
;;; Additional Major Modes
-(use-package csv-mode :ensure t)
-(use-package git-modes :ensure t)
-(use-package sed-mode :ensure t)
+(use-package awk-ts-mode :ensure t)
+(use-package git-modes :ensure t)
+(use-package sed-mode :ensure t)
+
+(use-package csv-mode
+ :ensure t
+ :custom
+ (csv-align-style 'auto)
+ (csv-align-padding 2))
;;; Mode-Specific Configurations