20

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.

25

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

4
  • Fantastic, I did look through the docs but must have missed this. Thanks very much
    – orion
    Sep 6 '16 at 1: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 6 '16 at 4:30
  • 6
    Every operating system or window manager I have used in the last 15 years has M-TAB bound to window switching... Apr 5 '18 at 10:10
  • 2
    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 6 '19 at 3:57
13

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.

2
  • 1
    2 - is exactly I needed, many thanks! Feb 24 '19 at 13:45
  • In particular, 2 works anywhere within the section.
    – Harald
    Jul 19 at 18:03
3

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.