1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-24 00:33:39 +08:00
ohmyzsh/plugins/per-directory-history
Marc Cornellà 568584a9f5
fix(per-directory-history): fix use of global history on shell start (#9008)
Updated from upstream: https://github.com/jimhester/per-directory-history/blob/d2e291d/per-directory-history.zsh

Fixes #9007
Closese #9008

Co-authored-by: Sebastian Marsching <sebastian-git-2016@marsching.com>
2021-10-04 17:14:34 +02:00
..
per-directory-history.plugin.zsh Update to latest per-directory-history 2013-02-28 10:28:08 -05:00
per-directory-history.zsh fix(per-directory-history): fix use of global history on shell start (#9008) 2021-10-04 17:14:34 +02:00
README.md per-directory-history: redo README for Oh My Zsh 2019-04-29 21:08:26 +02:00

per-directory-history plugin

This plugin adds per-directory history for zsh, as well as a global history,
and the ability to toggle between them with a keyboard shortcut. This is a
bundle of the official plugin by @jimhester.

To use it, add per-directory-history to the plugins array in your zshrc file:

plugins=(... per-directory-history)

This is an implementation of per-directory history for zsh, some implementations
of which exist in bash1,2. It also implements a toggle-history function
to change from using the directory history to using the global history. In both
cases the history is always saved to both the global history and the directory
history, so the toggle state will not effect the saved histories. Being able to
switch between global and directory histories on the fly is a novel feature.

Usage

The default mode is per directory history, interact with your history as normal.

Press ^G (the Control and G keys simultaneously) to toggle
between local and global histories. If you would prefer a different shortcut to
toggle set the PER_DIRECTORY_HISTORY_TOGGLE environment variable.

Configuration

  • HISTORY_BASE is a global variable that defines the base directory in which the
    directory histories are stored (default $HOME/.directory_history).
  • per-directory-history-toggle-history is the function to toggle between local
    and global histories.
  • PER_DIRECTORY_HISTORY_TOGGLE is the key binding used to run the toggle-history
    function above (default ^G)

History

The idea/inspiration for a per directory history is from Stewart MacArthur
and Dieter, the implementation idea is from Bart Schaefer. The
implementation is by Jim Hester in September 2012.