Magit: Is there a way I can toggle --ignore-all-space option for the default magit-status buffer?
Asked Answered
C

2

16

In the magit-status buffer I can press d-wd on a file to open a magit-diff buffer with the diff of that specific file without whitespace changes. When I go back to magit-status though, the diffs there still show the original whitespace changes. I'm not sure if this is built into magit already but what I'd like is for the original magit-status buffer to ignore whitespace changes as well (being able to toggle this would be amazing)

Communicant answered 16/12, 2019 at 23:43 Comment(0)
N
13

In magit-status, enter the diff mode by pressing d like you've done. Make your -w change. Then press C-x to see that there is an extended magit menu with more available items. You'll then see that C-s is a means to Save the settings you've made (e.g., --ignore-all-space) for future sessions.

Nina answered 17/12, 2019 at 0:36 Comment(4)
This is nice though what I was hoping for was the magit status buffer ignoring whitespace as well. Saving this setting allows me to see the diff in a new buffer when pressing dd on a file but the magit status buffer still shows whitespaceCommunicant
Thinking on it further though, ignoring whitespace on the magit status buffer doesn't seem like a good ideaCommunicant
@Communicant see github.com/magit/magit/issues/204#issuecomment-255276768 or my answer below :)Merca
@irregular, why doesn't it seem like a good idea?Monarchist
M
9

I had just this query. I think it makes sense to be able to ignore whitespace in the status buffer because you'll often want to see 'at a glance' just the significant changes you have made. In particular, when rebasing the extra hassle of switching to another window for this kind of sanity check can disturb what is already a fairly delicate workflow.

I found the solution here, reproduced for convenience:

You can press D (magit-diff-refresh-popup), set the flags you want (e.g., -b for --ignore-space-change), and then hit g.

You can also do C-x C-s as described in the accepted answer or w instead of g to save the defaults for again.

Merca answered 20/8, 2021 at 10:2 Comment(1)
This should without doubt be the accepted answer.Jaquelynjaquenetta

© 2022 - 2024 — McMap. All rights reserved.