13

In orgmode, how can I get below line wrap behavior:

  1. for text (other than table), I wish line wrapped.
  2. for table, I do not wish it's wrapped.

I can add below line in init.el

(global-visual-line-mode t)

But table will be wrapped also!

How can I line wrap except org tables?

lucky1928
  • 1,622
  • 8
  • 28

2 Answers2

0

In order to wrap the lines and not the table in org-mode you can fill the paragraph your cursor is on (in this example using M-q) instead of choosing wrap over truncate.

Borrowing the following function from @fniessen in Paragraph filling for org-mode inside latex environment in SO

(defun leuven-good-old-fill-paragraph ()
  (interactive)
  (let ((fill-paragraph-function nil)
        (adaptive-fill-function nil))
    (fill-paragraph)))

adding this local key binding:

(define-key org-mode-map "M-q" 'leuven-good-old-fill-paragraph)

Now you can selectively wrap the paragraphs and leave out the tables.

NickD
  • 27,023
  • 3
  • 23
  • 42
manandearth
  • 2,068
  • 1
  • 11
  • 23
0

As mentioned here, the package phscroll solves this using overlays! After installing the package just put this in your init.el and it will seem like tables are truncated (they look and behave that way) even in visual-line mode:

(with-eval-after-load "org"
  (org-phscroll-activate))
orgtre
  • 1,012
  • 4
  • 15