From: rearman Date: Wed, 1 Oct 2025 18:22:10 +0000 (-0400) Subject: Re-enable visual-line-mode and visual-fill-column X-Git-Url: https://git.earman.xyz/?a=commitdiff_plain;h=3cbaa31a769f98e1ae9848fe023bd3667d399457;p=emacsinit.git Re-enable visual-line-mode and visual-fill-column As well as the bindings and defuns to handle it --- diff --git a/init.el b/init.el index 5ff80bc..cac3cd2 100644 --- a/init.el +++ b/init.el @@ -29,8 +29,7 @@ (setq-default indicate-empty-lines t mouse-prefer-closest-glyph t - line-move-visual nil - word-wrap t) + fill-column 78) (blink-cursor-mode -1) (column-number-mode t) @@ -50,8 +49,7 @@ confirm-kill-processes nil mouse-1-click-follows-link nil focus-follows-mouse t - mouse-autoselect-window -0.25 - visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow)) + mouse-autoselect-window -0.25) ;; Recent Files/Buffers (midnight-mode t) diff --git a/re/re-bindings.el b/re/re-bindings.el index dbf417b..d34348c 100644 --- a/re/re-bindings.el +++ b/re/re-bindings.el @@ -41,8 +41,9 @@ (keymap-global-set "" #'previous-buffer) ; Back button (keymap-global-set "C-M-o" #'re/other-window-or-split-window) (keymap-global-set " " #'re/smart-beginning-of-line) +(keymap-global-set " " #'re/smart-end-of-line) (keymap-set visual-line-mode-map "C-a" #'re/smart-beginning-of-line) -(keymap-set visual-line-mode-map "C-e" #'move-end-of-line) +(keymap-set visual-line-mode-map "C-e" #'re/smart-end-of-line) (keymap-global-set " " #'re/goto-line) ;; Seeking diff --git a/re/re-editing-defuns.el b/re/re-editing-defuns.el index f80b8d4..9aafac9 100644 --- a/re/re-editing-defuns.el +++ b/re/re-editing-defuns.el @@ -74,7 +74,7 @@ Stolen from https://depp.brause.cc/dotemacs" (call-interactively 'backward-kill-word))) (defun re/smart-beginning-of-line () - "Move point to first non-whitespace character. + "Move point to first non-whitespace character or `beginning-of-visual-line'. If point was already at that position, call `back-to-indentation'. Called a third time, move point back to `beginning-of-line'. If in org-mode, call `org-beginning-of-line' first." @@ -83,7 +83,7 @@ If in org-mode, call `org-beginning-of-line' first." (if (equal major-mode 'org-mode) (org-beginning-of-line) (progn - (beginning-of-line 1) + (beginning-of-visual-line 1) (skip-syntax-forward " " (line-end-position)) (backward-prefix-chars))) (and (= oldpos (point)) @@ -91,6 +91,17 @@ If in org-mode, call `org-beginning-of-line' first." (back-to-indentation) (and (= newpos (point)) (beginning-of-line)))))) +(defun re/smart-end-of-line () + "Move point to the end of the visual line. + If point was already at that position, call `move-end-of-line'. +If in org-mode, call `org-end-of-line' first." + (interactive "^") + (let ((oldpos (point))) + (if (equal major-mode 'org-mode) + (org-end-of-line) + (end-of-visual-line 1)) + (and (= oldpos (point)) (move-end-of-line nil)))) + (defun re/goto-line () "Show line numbers before going to line, then hide them again." (interactive) diff --git a/re/re-packages.el b/re/re-packages.el index c1855ac..08d8af9 100644 --- a/re/re-packages.el +++ b/re/re-packages.el @@ -10,6 +10,16 @@ (setq use-package-always-ensure t use-package-always-demand t) +(use-package visual-fill-column + :config + (global-visual-line-mode 1) + :custom + (word-wrap t) + (visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow)) + (visual-fill-column-enable-sensible-window-split t) + :bind + (("C-c v" . visual-fill-column-mode))) + (use-package corfu :custom (corfu-auto t) @@ -33,7 +43,7 @@ (use-package expand-region :bind - (("C-=" quote er/expand-region))) + (("C-=" . er/expand-region))) (use-package magit :defer