From 3ddce92685c1b2daec8cb20496518d44497777c9 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 24 Feb 2021 17:42:53 -0600 Subject: Enable global-visual-line-mode --- config.org | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/config.org b/config.org index 18b2324..5225df9 100644 --- a/config.org +++ b/config.org @@ -1340,18 +1340,25 @@ that's the only time I accidentally call it, anyway. (add-hook 'text-mode-hook #'auto-fill-mode) #+end_src -2. /Just/ in case ... let's "fix" =visual-line-mode= if we're in =org-mode=. - - #+begin_src emacs-lisp :noweb-ref hooks - (defun hook--visual-line-fix-org-keys () - (when (derived-mode-p 'org-mode) - (local-set-key (kbd "C-a") #'org-beginning-of-line) - (local-set-key (kbd "C-e") #'org-end-of-line) - (local-set-key (kbd "C-k") #'org-kill-line))) - - (add-hook 'visual-line-mode-hook #'hook--visual-line-fix-org-keys) - - #+end_src +2a. Enable =visual-line-mode= everywhere. I do this because when I'm typing a +long line, I don't want it to accidentally push my viewport out to the right. I +want the text to invisibly wrap, and /then/ wrap "in the real world," as it were. + +#+begin_src emacs-lisp :noweb-ref modes + (global-visual-line-mode +1) +#+end_src + +2b. Let's "fix" =visual-line-mode= if we're in =org-mode=. + +#+begin_src emacs-lisp :noweb-ref hooks + (defun hook--visual-line-fix-org-keys () + (when (derived-mode-p 'org-mode) + (local-set-key (kbd "C-a") #'org-beginning-of-line) + (local-set-key (kbd "C-e") #'org-end-of-line) + (local-set-key (kbd "C-k") #'org-kill-line))) + + (add-hook 'visual-line-mode-hook #'hook--visual-line-fix-org-keys) +#+end_src I think that'll work -- I only care about line aesthetics with text. Programming modes should be /allowed/ to have long lines, regardless -- cgit 1.4.1-21-gabe81