1
votes

Is there a way to wrap text in org-mode without wrapping babel code blocks? Often times I run into a situation where a line of code is wider than my page and (ideally) should keep going. But because I have line wrapping enabled for the rest of the buffer, it gets wrapped as well.

Any ideas?

1

1 Answers

0
votes

Using @fniessen code from this answer:

(defun leuven-good-old-fill-paragraph ()
  (interactive)
  (let ((fill-paragraph-function nil)
        (adaptive-fill-function nil))
    (fill-paragraph)))
(define-key org-mode-map "\M-q" 'leuven-good-old-fill-paragraph)

In this example M-q is bound to fill-paragraph, you keep the buffer unwrapped and use M-q on selected paragraphs to wrap.