TruncateLines

Turn off wrapping for a single buffer using ‘M-x toggle-truncate-lines’.

This is a BufferLocalVariable. You can set the default value by customizing option ‘truncate-lines’ (‘M-x customize-option truncate-lines’) or by putting the following in your InitFile.

(set-default 'truncate-lines t)

This setting does not apply to horizontally-split windows. ‘C-x 3’ splits windows horizontally, where as ‘C-x 2’ splits them vertically.

To turn wrapping on in horizontally-split windows, use the following in your InitFile:

(setq truncate-partial-width-windows nil)

We don’t recommend it, either, because horizontally split windows are usually too small to read anyway. Note that this variable is not buffer-local.

See LineWrap for more info.

See PhysicalLineMove for a minor-mode that changes line movement commands (C-n, C-p, C-a, C-e) to take into account wrapped lines; useful if you don’t want to truncate lines!

Isn’t this deprecated by M-x visual-line-mode? I don’t see what else PhysicalLineMove would bring to the table.
What I like about truncate-lines versus visual-line-mode is that the former doesn’t split on word boundaries and adds symbols to the fringe.

If you want to set truncate-partial-width-windows just for a certain mode, you need to put the setting in a hook:

(add-hook 'diff-mode-hook (lambda () (setq truncate-lines t)))

Nano truncates lines so that when you scroll toward the end of one, the line itself moves to the left independently of the rest of the text. I’ve had a surprisingly hard time finding any talk of this feature in emacs. Is it possible?


CategoryDisplay CategoryFilling