0

For me it seems like a really ruff edge that default spacemacs comes without an option to give my lines a correct indentation, when they are wrapped. (Click the first link if you want to see the issue visualized.) I really need that feature, because I want to have a small org-mode window open at the side of my screen to organize my thoughts while working. (So far I have used workflowy for that, but orgmode seems much more tempting with the vimkeys and with more power). So this happens when I turn truncate-lines on.

Things I tried so far to fix this (sorry if I did things wrong, I just started using emacs): I tried adding packages according to Make visual-line-mode more compatible with org-mode modifying the following variable:
dotspacemacs-additional-packages '(visual-line-mode adaptive-wrap)

Since it still did not work out I added the following code to my dotspacemacs/user-config according to Correct indentation for wrapped lines:

adaptive-wrap-extra-indent 2

add-hook 'visual-line-mode-hook #'adaptive-wrap-prefix-mode

global-visual-line-mode +1

But no change came to my wrapped lines... Any help sincerely appreciated!

tbrodbeck
  • 177
  • 1
  • 10

1 Answers1

1

If you are on the develop branch - check to see if an adaptive-wrap is installed by checking if the corresponding folder is actually in your ~/.emacs.d/elpa/26.2/develop directory (modulo versions). If it is missing, then install it by editing your .spacemacs file and adding it to the dotspacemacs-additional-packages in defun dotspacemacs/layers.

Then, the second solution you mentioned should work using

(defun dotspacemacs/user-config ()
 (setq-default adaptive-wrap-extra-indent 2)
 (add-hook 'visual-line-mode-hook #'adaptive-wrap-prefix-mode)
 (global-visual-line-mode +1)
)

To adjust the indentation of the truncated lines, change the default for adaptive-wrap-extra-indent (I set it to 0 to keep truncated lines level with the parent). This worked for me with respect to .tex files, so I don't know if .org files will follow suit, or if we even have the same root for the problem!

Ahnaf Rafi
  • 11
  • 2
  • Hey thanks for your answer! I put all the code right below the scope of the default setq-default inside of dotspacemacs/user-config. But it did not wrap the file in the expected way (this should also work for the wrapping of the .spacemacs file right?). – tbrodbeck May 23 '19 at 11:16
  • Hey I played around with spacemacs for a while and realized that in my config without any costum code, when using t L instead of t l it already does exactly what I expected it to do. And I can do extra-indent with the help of your code too :) I just put ` adaptive-wrap-extra-indent 0` It is just odd, that the comment symbols get carried over as well. Is there a way to turn this off too? – tbrodbeck May 25 '19 at 11:16
  • And one more question: How to enable visual-line-mode by default (for every type of file in spacemacs)? – tbrodbeck May 25 '19 at 11:39