← [[doom-module-index:][Back to module index]] ! [[doom-module-issues:::editor word-wrap][Issues]] ↖ [[doom-repo:tree/develop/modules/editor/word-wrap/][Github]] ± [[doom-suggest-edit:][Suggest edits]] ? [[doom-help-modules:][Help]] -------------------------------------------------------------------------------- #+TITLE: :editor word-wrap #+SUBTITLE: Soft-wrapping with language-aware indent #+CREATED: August 25, 2019 #+SINCE: 21.12.0 (#1709) * 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. ** Maintainers - [[doom-user:][@flatwhatson]] [[doom-contrib-maintainer:][Become a maintainer?]] ** Module flags /This module has no flags./ ** Packages - [[doom-package:][adaptive-wrap]] ** Hacks /No hacks documented for this module./ ** TODO Changelog # This section will be machine generated. Don't edit it by hand. /This module does not have a changelog yet./ * Installation [[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]] /This module has no external requirements./ * TODO Usage #+begin_quote 🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]] #+end_quote * TODO Configuration #+begin_quote 🔨 /This module's configuration documentation is incomplete./ [[doom-contrib-module:][Complete it?]] #+end_quote ** 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 [[kbd:][SPC t w]] for ~evil~ users. To enable wrapping in a specific mode, add it to the appropriate hook in your ~config.el~: #+begin_src emacs-lisp ;; enable word-wrap in C/C++/ObjC/Java (add-hook 'c-mode-common-hook #'+word-wrap-mode) #+end_src To customize the behaviour in a specific mode: #+begin_src emacs-lisp ;; use a single indent in json-mode (add-hook! 'json-mode-hook (setq-local +word-wrap-extra-indent 'single) (+word-wrap-mode +1)) #+end_src To turn on word wrapping (almost) everywhere: #+begin_src emacs-lisp ;; enable word-wrap (almost) everywhere (+global-word-wrap-mode +1) #+end_src To disable global word-wrapping in a specific mode: #+begin_src emacs-lisp ;; disable global word-wrap in emacs-lisp-mode (add-to-list '+word-wrap-disabled-modes 'emacs-lisp-mode) #+end_src ** 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 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./ [[doom-report:][Report one?]] * Frequently asked questions /This module has no FAQs yet./ [[doom-suggest-faq:][Ask one?]] * TODO Appendix #+begin_quote 🔨 This module has no appendix yet. [[doom-contrib-module:][Write one?]] #+end_quote