]> git.earman.xyz Git - emacsinit.git/commitdiff
Re-enable visual-line-mode and visual-fill-column
authorrearman <rearman@r717.net>
Wed, 1 Oct 2025 18:22:10 +0000 (14:22 -0400)
committerrearman <rearman@r717.net>
Wed, 1 Oct 2025 18:22:10 +0000 (14:22 -0400)
As well as the bindings and defuns to handle it

init.el
re/re-bindings.el
re/re-editing-defuns.el
re/re-packages.el

diff --git a/init.el b/init.el
index 5ff80bc507178dea8cdd5b6b4f82c2e556457ebb..cac3cd282a033e26622009ccbbac31e6f2809ece 100644 (file)
--- 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)
index dbf417b73d3c3217ab672958291b0ab262502445..d34348c9c1fb7266990a74895aa9bb9b0d4f69af 100644 (file)
@@ -41,8 +41,9 @@
 (keymap-global-set "<mouse-4>" #'previous-buffer) ; Back button
 (keymap-global-set "C-M-o" #'re/other-window-or-split-window)
 (keymap-global-set "<remap> <move-beginning-of-line>" #'re/smart-beginning-of-line)
+(keymap-global-set "<remap> <move-end-of-line>" #'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 "<remap> <goto-line>" #'re/goto-line)
 
 ;; Seeking
index f80b8d40594e784f9ab452f6f6ef2b557781f60e..9aafac9ef16c3080c67ec42838cfa5de71ce3ade 100644 (file)
@@ -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)
index c1855ac5a970554e3e296e28d2d7893217798b4a..08d8af9d12908160445ad39c9b08096cd397c817 100644 (file)
 (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