doom-emacs/modules/editor/word-wrap
Henrik Lissner 19b18b89f9
bump: visual-fill-column
https://codeberg.org/joostkremers/visual-fill-column@db7c7c236555 -> emacsmirror/visual-fill-column@5e74afe39d

codeberg has uptime issues. Where possible, we should prefer Github
sources.

Fix: #7013
2024-05-21 17:16:48 +02:00
..
autoload.el feat(word-wrap): add soft-wrapping at fill-column 2023-02-18 15:27:47 -05:00
config.el feat(word-wrap): add soft-wrapping at fill-column 2023-02-18 15:27:47 -05:00
packages.el bump: visual-fill-column 2024-05-21 17:16:48 +02:00
README.org docs(*): replace all-the-icons with nerd-icons 2024-05-21 17:16:13 +02:00

:editor word-wrap

Description   unfold

This module adds a minor-mode fn:+word-wrap-mode, which intelligently wraps long lines in the buffer without modifying the buffer content.

Module flags

This module has no flags.

Hacks

No hacks documented for this module.

TODO Changelog

This module does not have a changelog yet.

Installation

Enable this module in your doom! block.

This module has no external requirements.

TODO Usage

󱌣 This module has no usage documentation yet. Write some?

TODO Configuration

󱌣 This module's configuration documentation is incomplete. Complete it?

Activation

Word wrapping is not enabled by default.

Wrapping can be toggled in the current buffer with M-x +word-wrap-mode. The default doom bindings bind this to SPC t w for evil users.

To enable wrapping in a specific mode, add it to the appropriate hook in $DOOMDIR/config.el:

;; enable word-wrap in C/C++/ObjC/Java
(add-hook 'c-mode-common-hook #'+word-wrap-mode)

To customize the behaviour in a specific mode:

;; use a single indent and wrap at fill-column in json-mode
(add-hook! 'json-mode-hook
  (setq-local +word-wrap-extra-indent 'single
              +word-wrap-fill-style 'soft)
  (+word-wrap-mode +1))

To turn on word wrapping (almost) everywhere:

;; enable word-wrap (almost) everywhere
(+global-word-wrap-mode +1)

To disable global word-wrapping in a specific mode:

;; disable global word-wrap in emacs-lisp-mode
(add-to-list '+word-wrap-disabled-modes 'emacs-lisp-mode)

Settings

Wrapped lines will be indented to match the preceding line. In code buffers, lines which are not inside a string or comment will have extra indentation as determined by +word-wrap-extra-indent. The default is to increase the indent by twice the major-mode indent.

The +word-wrap-extra-indent variable supports the following values:

  • double: indent by twice the major-mode indentation
  • single: indent by the major-mode indentation
  • a positive integer: indent by this fixed amount
  • a negative integer: dedent by this fixed amount
  • nil: no extra indent

Long lines are wrapped at the window margin by default, however soft-wrapping at fill-column is supported by setting +word-wrap-fill-style. When set to auto, if auto-fill-mode is enabled in the buffer, its behavior will not be affected. This allows hard and soft wrapping methods to co-exist, with hard-wrapping for new lines and soft-wrapping for existing lines. To disable hard-wrapping entirely, set +word-wrap-fill-style to soft.

This module also includes a global minor-mode +global-word-wrap-mode to automatically enable wrapping in most buffers. Wrapping will not be enabled in buffers whose major mode is marked "special", or are listed in +word-wrap-disabled-modes.

The +word-wrap-text-modes variable lists modes which shouldn't have any extra indentation, regardless of the +word-wrap-extra-indent setting. This is useful for modes which are primarily text, such as text-mode and markdown-mode.

The +word-wrap-visual-modes variable lists modes which should only enable visual-line-mode and not provide any prefix indentation. This is useful for modes like org-mode which handle prefix indentation themselves.

Troubleshooting

There are no known problems with this module. Report one?

Frequently asked questions

This module has no FAQs yet. Ask one?

TODO Appendix

󱌣 This module has no appendix yet. Write one?