13

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)

irregular
  • 1,437
  • 3
  • 20
  • 39

2 Answers2

11

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.

Micah Elliott
  • 9,600
  • 5
  • 51
  • 54
  • 3
    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 whitespace – irregular Jan 08 '20 at 18:26
  • Thinking on it further though, ignoring whitespace on the magit status buffer doesn't seem like a good idea – irregular Jan 08 '20 at 18:51
  • @irregular see https://github.com/magit/magit/issues/204#issuecomment-255276768 or my answer below :) – robert Aug 20 '21 at 10:03
  • @irregular, why doesn't it seem like a good idea? – Drew Verlee Mar 28 '23 at 19:00
5

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.

robert
  • 4,612
  • 2
  • 29
  • 39