A configurable jump list implementation for Emacs that can be used to easily jump back to previous locations.
Better-jumper is available on MELPA.
M-x package-install better-jumper
better-jumper comes with two global modes:
better-jumper-override-mode, and two local modes:
You can either a) enable one or both globally:
(better-jumper-mode +1) ;; and disable in specific modes (push 'python-mode better-jumper-disabled-modes) ;; or disable it manually (add-hook 'python-mode-hook #'turn-off-better-jumper-mode)
Or b) enable one or both locally, where you need it:
(add-hook 'python-mode-hook 'turn-on-better-jumper-mode
better-jumper has been loaded it is ready to start tracking jump history.
better-jumper-set-jump is invoked the current location is added to
either the window or buffer specific jump list (depending on the
better-jumper-context setting). At any time the jump backward/forward
functions can be used to navigate through the jump history.
If you are an
evil user then
better-jumper can piggy back off of the built
in jumplist implementation to track when jumps occur. The setting
better-jumper-use-evil-jump-advice dictates this behavior and defaults to
better-jumper does not interact with or alter evil's jump list in
Summary of interactive commands
|better-jumper-set-jump||Add a new jump location to jump list using current buffer/position|
|better-jumper-jump-backward||Jump to back to previous location in jump list|
|better-jumper-jump-forward||Jump forward to next location in jump list|
|better-jumper-get-jumps||Get jump state for window or buffer|
|better-jumper-set-jumps||Set jump state for window or buffer|
Configure the standard jump list navigation keybindings for evil/vim:
(with-eval-after-load 'evil-maps (define-key evil-motion-state-map (kbd "C-o") 'better-jumper-jump-backward) (define-key evil-motion-state-map (kbd "<C-i>") 'better-jumper-jump-forward))
Jump Context (
This setting specifies the context in which jump lists are tracked. This can
either be set to
'window. If the value is
'buffer then a jump
list is maintained for each individual buffer. Conversly, if the value is
'window then the jump list is maintained per window and will operate across
buffers in that window.
While in the
'window context, jump lists are stored as persistent window
parameters and can be saved and restored along with the window configuration
using something like
persp-mode. This is the default context.
While in the
'buffer context, jump lists are maintained using buffer-local
variables and can optionally by saved using
New Window Behavior (
This setting specifies the behavior that will take place when a new window is
created AND the current context is set to
'window. This can be either set to
'empty. If the value is
'copy then the last selected window's
jump list will be copied to the new window. If the value is
'empty then the
new window's jump list will start empty.
Max Length (
This is a numeric value that dictate the maximum length that a jump list can grow to. If the length of a jump list exceeds this size then the oldest items in the list will be dropped.
Use Evil Jump Advice (
If non-nil better jumper will attach a piece of advice to the
function that will ensure that anytime a jump is added using
corresponding jump will be added using
If non-nil better jumper will use savehist to save jump history. This is
currently only implemented for the
'buffer context. Persistent window
parameters are used to save and restore jump history for windows.
This number dictates how many of the most recent buffers should have their jump
state saved to the savehist file when savehist is enabled the the context is set
Pre-jump Hook (
A hook that is invoked before a jump occurs.
Post-jump Hook (
A hook that is invoked after a jump occurs.
This package was heavily inspired by
evil-jump and initially was planned as a
modification of or pull request to
evil. It was primarily born out of the
desire to isolate jumps across
persp-mode perspectives, however the changes
proved to be to large to be a simple modification. Additionally, this package
provides more customization options as well as a few other core improvements.
A few advantages of
Uses window persistent parameters to store jump lists. As a result
better-jumperproperly works with
persp-modeand any other feature that manages window configurations.
True buffer specific jump lists. When instructed to not cross buffer boundaries
evil-jumperstill tracks jumps per window only limits the jumps available to ones located in the current buffer.
Configurable new window behavior.
evil-jumperALWAYS copies the jump list from the previously selected window to any newly created window.
Jump locations are stored as
markers so they will maintain a more accurate location in the buffer. However, due to the fact that markers can't be serialized they are down converted to simple buffer positions when saved either via window configuration or savehist.
savehistsupport is only limited to the
'buffercontext. When running in the
'windowcontext, the jump list is stored as a persistent window parameter and is intended to be saved using alongside the window configuration using somethinig like