Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

emacs

magit

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)

like image 816
irregular Avatar asked Dec 16 '19 23:12

irregular


2 Answers

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.

like image 165
Micah Elliott Avatar answered Nov 13 '22 14:11

Micah Elliott


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.

like image 31
robert Avatar answered Nov 13 '22 13:11

robert