Improve +word-wrap in non-code buffers

Adds `+word-wrap-text-modes`, a list of modes which shouldn't get any
extra indentation. This is used for text and markdown modes, which
should just indent to the parent depth.

Adds `+word-wrap-visual-modes`, a list of modes which shouldn't enable
`adaptive-wrap-prefix-mode`. This is used to fix the prefix indentation
in `org-mode`, which provides its own implementation.

Tweaks the indent behaviour to treat strings the same as comments so
they don't receive additional indentation.
This commit is contained in:
Andrew Whatson 2019-10-15 00:51:28 +10:00
parent 24b336322c
commit 930d0d134a
3 changed files with 62 additions and 29 deletions

View file

@ -1,15 +1,26 @@
;;; editor/word-wrap/config.el -*- lexical-binding: t; -*-
(defvar +word-wrap-extra-indent 'double
"The amount of extra indentation for wrapped non-comment lines.
"The amount of extra indentation for wrapped code lines.
When 'double, indent by twice the major-mode indentation.
When 'single, indent by the major-mode indentation.
When a positive integer, indent by this fixed amount.
When a negative integer, dedent by this fixed amount.
Otherwise no extra indentation will be used.")
(defvar +word-wrap-disabled-modes
'(fundamental-mode so-long-mode)
"Major-modes where `+global-word-wrap-mode' should not enable
`+word-wrap-mode'.")
`+word-wrap-mode'.")
(defvar +word-wrap-visual-modes
'(org-mode)
"Major-modes where `+word-wrap-mode' should not use
`adaptive-wrap-prefix-mode'.")
(defvar +word-wrap-text-modes
'(text-mode markdown-mode markdown-view-mode gfm-mode gfm-view-mode rst-mode
latex-mode LaTeX-mode)
"Major-modes where `+word-wrap-mode' should not provide extra indentation.")