25

Pressing TAB on a single unstaged file shows or hides details pertaining to that file.

How do I show & hide (toggle) details of all unstaged files at once?

I did come across outline-hide-sublevels via M-x. But I would like to know a key combination to do this in a toggle fashion.

I also typed ? to check the keybinding shortcuts for the magit-status area but could not find an answer.

orion
  • 805
  • 8
  • 16

4 Answers4

33

I think you want M-TAB magit-section-cycle-diffs

Cycle the visibility of diff-related sections in the current buffer.

https://magit.vc/manual/magit.html#Section-Visibility-1

Jack
  • 760
  • 8
  • 10
  • Fantastic, I did look through the docs but must have missed this. Thanks very much – orion Sep 06 '16 at 01:31
  • @orion Happy to hear that's what you were looking for. If this fully answers your question you can click the checkmark to the left of this answer to "accept" it so others know the question is complete. – Jack Sep 06 '16 at 04:30
  • 6
    Every operating system or window manager I have used in the last 15 years has `M-TAB` bound to window switching... – Fred Schoen Apr 05 '18 at 10:10
  • 3
    Actually what I was looking for was M-2 or M-4 from anywhere in the magit buffer to expand and collapse all, which is documented in the link Jack provided – orion Feb 06 '19 at 03:57
18

Another method (if you do not want to change key bindings for the M-TAB solution) is to position your cursor on the line with the section heading, e.g. "Unstaged changes", and press 2 to collapse all changes in that section, or 4 to expand them.

It also works for collapsing/expanding changes per subsection/file.

Elardus Erasmus
  • 181
  • 1
  • 3
5

You can use S-TAB (that's shift) to invoke magit-section-cycle-global for a coarse-granularity full-expand and -collapse.

Micah Elliott
  • 221
  • 3
  • 6
0

The following works as an replacement to M-tab.

(define-key magit-mode-map [(control >)] 'magit-section-cycle-diffs)

M-tab doesn't work on most MS Windows systems

Drew
  • 75,699
  • 9
  • 109
  • 225
David
  • 1