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
3cc61701
Commit
3cc61701
authored
Oct 04, 2016
by
Marc Cornellà
Committed by
GitHub
Oct 04, 2016
Browse files
Update per-directory-history plugin to latest version (#5493)
Latest version: February 17, 2016 - dd81201
parent
99dbf322
Changes
2
Hide whitespace changes
Inline
Side-by-side
plugins/per-directory-history/README.md
View file @
3cc61701
...
@@ -27,9 +27,8 @@ Usage
...
@@ -27,9 +27,8 @@ Usage
2.
The default mode if per directory history, interact with your history as normal.
2.
The default mode if per directory history, interact with your history as normal.
3.
Press ^G (the Control and G keys simultaneously) to toggle between local
3.
Press ^G (the Control and G keys simultaneously) to toggle between local
and global histories.
and global histories. If you would prefer a different shortcut to toggle
set the PER_DIRECTORY_HISTORY_TOGGLE environment variable.
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Configuration
Configuration
...
...
plugins/per-directory-history/per-directory-history.zsh
View file @
3cc61701
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#
#
################################################################################
################################################################################
#
#
# Copyright (c) 201
2
Jim Hester
# Copyright (c) 201
4
Jim Hester
#
#
# This software is provided 'as-is', without any express or implied warranty.
# This software is provided 'as-is', without any express or implied warranty.
# In no event will the authors be held liable for any damages arising from the
# In no event will the authors be held liable for any damages arising from the
...
@@ -57,6 +57,7 @@
...
@@ -57,6 +57,7 @@
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
[[
-z
$HISTORY_BASE
]]
&&
HISTORY_BASE
=
"
$HOME
/.directory_history"
[[
-z
$HISTORY_BASE
]]
&&
HISTORY_BASE
=
"
$HOME
/.directory_history"
[[
-z
$PER_DIRECTORY_HISTORY_TOGGLE
]]
&&
PER_DIRECTORY_HISTORY_TOGGLE
=
'^G'
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# toggle global/directory history used for searching - ctrl-G by default
# toggle global/directory history used for searching - ctrl-G by default
...
@@ -76,7 +77,7 @@ function per-directory-history-toggle-history() {
...
@@ -76,7 +77,7 @@ function per-directory-history-toggle-history() {
autoload per-directory-history-toggle-history
autoload per-directory-history-toggle-history
zle
-N
per-directory-history-toggle-history
zle
-N
per-directory-history-toggle-history
bindkey
'^G'
per-directory-history-toggle-history
bindkey
$PER_DIRECTORY_HISTORY_TOGGLE
per-directory-history-toggle-history
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# implementation details
# implementation details
...
@@ -108,7 +109,7 @@ function _per-directory-history-change-directory() {
...
@@ -108,7 +109,7 @@ function _per-directory-history-change-directory() {
}
}
function
_per-directory-history-addhistory
()
{
function
_per-directory-history-addhistory
()
{
print
-Sr
--
${
1
%%
$'
\n
'
}
print
-Sr
--
"
${
1
%%
$'
\n
'
}
"
fc
-p
$_per_directory_history_directory
fc
-p
$_per_directory_history_directory
}
}
...
@@ -140,8 +141,9 @@ function _per-directory-history-set-global-history() {
...
@@ -140,8 +141,9 @@ function _per-directory-history-set-global-history() {
#add functions to the exec list for chpwd and zshaddhistory
#add functions to the exec list for chpwd and zshaddhistory
chpwd_functions
=(
${
chpwd_functions
[@]
}
"_per-directory-history-change-directory"
)
autoload
-U
add-zsh-hook
zshaddhistory_functions
=(
${
zshaddhistory_functions
[@]
}
"_per-directory-history-addhistory"
)
add-zsh-hook chpwd _per-directory-history-change-directory
add-zsh-hook zshaddhistory _per-directory-history-addhistory
#start in directory mode
#start in directory mode
mkdir
-p
${
_per_directory_history_directory
:h
}
mkdir
-p
${
_per_directory_history_directory
:h
}
...
...
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