Geek · Things I've Learned

How to Prevent Lines from Wrapping in Emacs

By default, Emacs’s buffer list truncates lines at the right edge of the screen: if you’re editing a file with a long name, it doesn’t wrap around; you have to use C-x < and C-x > to scroll the viewport left and right.

I’d always wondered how to do that, since it can be useful when editing files like ~/.ssh/known_hosts, where the useful information is at the beginning of the line, and the wrapped keys get in the way.

Now I know:

(setq truncate-lines t)

One thought on “How to Prevent Lines from Wrapping in Emacs

  1. Ha ha, finally! Every now and then I’d accidentally scroll the viewport in Emacs. I never knew what was going on when that happened, and rather than spend time reading the manual to find out when it happened, I always just saved, quit, and reloaded. Thanks to you, next time I’ll know what it is :).

Comments are closed.