How to enable/disable word wrap in emacs?

To enable (or disable) word wrap (a.k.a. “line wrapping”) in emacs press the M-x key (usually Alt-X on PC’s) and then in the emacs minibuffer type:

toggle-truncate-lines <RET>

The ‘<RET>’ means that you need to press the Enter key after you have typed “toggle-truncate-lines” in the emacs mini buffer.

This will toggle the behaviour for the current buffer, switching back and forthe between linewrap ON and OFF.

If you want to set a default, such that all new buffers from now on be opened in your preferred mode then edit your ~/.emacs file (it is in your user home directory) and add one of the the following lines to it:

To have emacs wordwrap OFF add:
(setq-default truncate-lines 1)

To have emacs word-wrap ON add:
(setq-default truncate-lines 0)

2 thoughts on “How to enable/disable word wrap in emacs?

Leave a Reply

Your email address will not be published. Required fields are marked *