Enable global-visual-line-mode

This commit is contained in:
Case Duckworth 2021-02-24 17:42:53 -06:00
parent 0f03ac1076
commit 3ddce92685

View File

@ -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=.
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 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)))
#+begin_src emacs-lisp :noweb-ref modes
(global-visual-line-mode +1)
#+end_src
(add-hook 'visual-line-mode-hook #'hook--visual-line-fix-org-keys)
#+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