To move within a section use the usual keys (C-p
, C-n
, C-b
, C-f
etc),
whose global bindings are not shadowed. To move to another section use
the following commands.
The section movement commands described here run the hook
magit-section-movement-hook
. Note that they explicitly run that hook
and that aribrary other movement, defined in Emacs and other packages,
do not run that hook. That hook, and hook functions that can be added
to it, or are part of its default value, are described below.
magit-section-backward
) ¶When not at the beginning of a section, then move to the beginning of the current section. At the beginning of a section, instead move to the beginning of the previous visible section.
magit-section-forward
) ¶Move to the beginning of the next visible section.
magit-section-backward-siblings
) ¶Move to the beginning of the previous sibling section. If there is no previous sibling section, then move to the parent section instead.
magit-section-forward-siblings
) ¶Move to the beginning of the next sibling section. If there is no next sibling section, then move to the parent section instead.
magit-section-up
) ¶Move to the beginning of the parent of the current section.
The above commands all call the hook magit-section-movement-hook
.
Any of the functions listed below can be used as members of this hook.
You might want to remove some of the functions that Magit adds using
add-hook
. In doing so you have to make sure you do not attempt to
remove function that haven’t even been added yet, for example:
(with-eval-after-load 'magit-diff (remove-hook 'magit-section-movement-hook 'magit-hunk-set-window-start))
This hook is run by all of the above section movement commands,
after arriving at the destination. It is not run by arbitrary other
movement commands (such as next-line
), which are provided by Emacs
or third-party packages.
This hook function ensures that the beginning of the current section
is visible, provided it is a hunk
section. Otherwise, it does
nothing.
Loading magit-diff
adds this function to the hook.
This hook function ensures that the beginning of the current section
is visible, regardless of the section’s type. If you add this to
magit-section-movement-hook
, then you must remove the hunk-only
variant in turn.
This hook function only has an effect in log buffers, and point
is
on the "show more" section. If that is the case, then it doubles
the number of commits that are being shown.
Loading magit-log
adds this function to the hook.
When moving inside a log buffer, then this function updates the revision buffer, provided it is already being displayed in another window of the same frame.
Loading magit-log
adds this function to the hook.
When moving inside a log buffer and another window of the same frame displays a blob buffer, then this function instead displays the blob buffer for the commit at point in that window.
When moving inside a status buffer, then this function updates the revision buffer, provided it is already being displayed in another window of the same frame.
When moving inside a status buffer, then this function updates the stash buffer, provided it is already being displayed in another window of the same frame.
When moving inside a status buffer and another window of the same frame displays a blob buffer, then this function instead displays the blob buffer for the commit at point in that window.
When moving inside a buffer listing stashes, then this function updates the stash buffer, provided it is already being displayed in another window of the same frame.
Delay before automatically updating the other window.
When moving around in certain buffers using Magit’s own section movement commands (but not other movement commands), then certain other buffers, which are being displayed in another window, may optionally be updated to display information about the section at point.
When holding down a key to move by more than just one section, then that would update that buffer for each section on the way. To prevent that, updating the revision buffer is delayed, and this option controls for how long. For optimal experience you might have to adjust this delay and/or the keyboard repeat rate and delay of your graphical environment or operating system.