How can I enable line wrap on word boundaries only in Emacs?

Solution 1:

If you want to emulate the behavior of an editor like Notepad, you might want to turn on visual line mode. While setting word-wrap will cause line wrapping at word boundaries, any action you take on a line (e.g., moving up/down or killing) will still respect the newline character. Visual line mode will treat each display line as though it had a newline at the end.

(visual-line-mode t)

Line to add in .emacs file:

(global-visual-line-mode t)

Solution 2:

M-x toggle-truncate-lines disable allows you to disable visually line breaking.

M-x auto-fill-mode + M-q allows you to word wrap for real a pre-existing paragraph.

Solution 3:

Add this to your init file:

(setq-default word-wrap t)

Alternatively, press C-h vword-wrap in Emacs and follow the "customize" link near the end.

Solution 4:

I discovered longlines-mode only recently (I think I was spelunking through the Emacs Info documentation). It wraps as you would expect in other UI editors' word-wrap feature. It's especially useful when I'm reading or writing free text with no newlines (a la Microsoft Word) without the ugly mid-word wrapping that happens when you use M-x toggle-word-wrap.

See LongLines.

My configuration:

(setq longlines-wrap-follows-window-size t)
(global-set-key [(control meta l)] 'longlines-mode)