0

Imagine I have a line that is longer than the available space. I want this one physical line to be displayed as multiple ones (so that I can see it in full without scrolling). In the screenshot below you see one logical line displayed as two (red rectangle):

Screenshot 1

When I open the same file in Emacs, Org mode, type :vsp, then that same line is truncated:

Screenshot 2

How can I make sure that this line is displayed in Emacs like it is in Vim (see screenshot above)?

I tried the following:

  1. Adding (setq-default truncate-lines nil) to .emacs file as suggested here (then restarting Emacs).
  2. M-x auto-fill-mode or M-x fill-region as suggested here.

None of this helped.

Glory to Russia
  • 225
  • 2
  • 9
  • Please read this question/answer: https://superuser.com/questions/299886/linewrap-in-org-mode-of-emacs – jue Nov 25 '19 at 10:26

1 Answers1

4

Click on Options / Line wrapping in this buffer / Wrap at window edge to change it for the current buffer.

To change it on a permanent basis, you will need to search your initialization file(s) for truncate-lines: somebody must be setting it to t for Org mode buffers. You will need to change that setting to nil. If it only happens on partial-width windows (as shown in your screenshots), you might want to look at truncate-partial-width-windows as Jean Pierre points out in a comment. Setting both of these variables to nil (and making sure that nobody overrides those settings) will ensure that lines are wrapped always.

Here's the doc string for truncate-lines:

truncate-lines is a variable defined in ‘C source code’. Its value is nil

Automatically becomes permanently buffer-local when set. Calls these functions when changed: (#) This variable is safe as a file local variable if its value satisfies the predicate ‘booleanp’. You can customize this variable. Probably introduced at or before Emacs version 1.7.

Documentation: Non-nil means do not display continuation lines. Instead, give each line of text just one screen line.

Note that this is overridden by the variable ‘truncate-partial-width-windows’ if that variable is non-nil and this buffer is not full-frame width.

Minibuffers set this variable to nil.

NickD
  • 27,023
  • 3
  • 23
  • 42