Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Oh My Zsh
Commits
4eae0549
Unverified
Commit
4eae0549
authored
Apr 29, 2019
by
Marc Cornellà
Committed by
GitHub
Apr 29, 2019
Browse files
per-directory-history: redo README for Oh My Zsh
Closes #7726
parent
56610be1
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/per-directory-history/README.md
View file @
4eae0549
[P
er-
D
irectory-
H
istory
][6]
p
er-
d
irectory-
h
istory
plugin
=========================
----------------------------
Per directory history for zsh, as well as global history, and the
This plugin adds per-directory history for zsh, as well as a global history,
ability to toggle between them with ^G.
and the ability to toggle between them with a keyboard shortcut. This is a
bundle of the
[
official plugin by @jimhester
][
5
]
.
This is a implementation of per directory history for zsh, some
To use it, add
`per-directory-history`
to the plugins array in your zshrc file:
implementations of which exist in bash
[
1
][]
,
[
2
][]
. It also implements
a per-directory-history-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 as far
as I am aware.
This is a standalone repository for the script, however it is also included in
```
zsh
[
oh-my-zsh
][
4
]
as a plugin.
plugins
=(
... per-directory-history
)
```
----------------------------------------------------------------------------
This is an implementation of per-directory history for zsh, some implementations
Usage
of which exist in bash
[
1
][]
,
[
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.
1.
Load this script into your interactive ZSH session:
## Usage
% source zsh-
per
-
directory
-
history
.zsh
The default mode is
per
directory
history
, interact with your history as normal.
2.
The default mode if per directory history, interact with your history as normal.
Press ^G (the
<kbd>
Control
</kbd>
and
<kbd>
G
</kbd>
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.
3.
Press ^G (the Control and G keys simultaneously) to toggle between local
## Configuration
and global histories. If you would prefer a different shortcut to toggle
set the PER_DIRECTORY_HISTORY_TOGGLE environment variable.
-------------------------------------------------------------------------------
*
`HISTORY_BASE`
is a global variable that defines the base directory in which the
Configuration
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_BASE a global variable that defines the base directory in which the
## History
directory histories are stored
*
per-directory-history-toggle-history is the function to toggle the history
-------------------------------------------------------------------------------
History
-------------------------------------------------------------------------------
The idea/inspiration for a per directory history is from
[
Stewart MacArthur
][
1
]
The idea/inspiration for a per directory history is from
[
Stewart MacArthur
][
1
]
and
[
Dieter
][
2
]
, the implementation idea is from
[
Bart Schaefer
][
3
]
.
The
and
[
Dieter
][
2
]
, the implementation idea is from
[
Bart Schaefer
][
3
]
. The
implementation is by
[
Jim Hester
][
5
]
in September 2012.
implementation is by
[
Jim Hester
][
4
]
in September 2012.
[
1
]:
http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html
[
1
]:
http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html
[
2
]:
http://dieter.plaetinck.be/per_directory_bash
[
2
]:
http://dieter.plaetinck.be/per_directory_bash
[
3
]:
https://www.zsh.org/mla/users/1997/msg00226.html
[
3
]:
https://www.zsh.org/mla/users/1997/msg00226.html
[
4
]:
https://github.com/robbyrussell/oh-my-zsh
[
4
]:
https://jimhester.com
[
5
]:
http://jimhester.com
[
5
]:
https://github.com/jimhester/per-directory-history
[
6
]:
https://github.com/jimhester/per-directory-history
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment