Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per directory history plugin #1321

Merged
merged 2 commits into from
Sep 23, 2012

Conversation

jimhester
Copy link
Contributor

This is a implementation of per directory history for zsh, some
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. The default binding to switch between using the local
directory history and the global history is ctrl-g

   This is a implementation of per directory history for zsh, some
   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.

   [1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html
   [2]: http://dieter.plaetinck.be/per_directory_bash
Use the HISTFILE environment variable in place of copying it to
_per_directory_history_global so that users can change the environment variable
after sourcing per-directory-history and have the global variable set correctly
@robbyrussell
Copy link
Member

Thanks Jim, could you add some details to the Plugins wiki page for us?

robbyrussell added a commit that referenced this pull request Sep 23, 2012
@robbyrussell robbyrussell merged commit 523b26c into ohmyzsh:master Sep 23, 2012
@jimhester
Copy link
Contributor Author

Sure, I have added an entry for the plugin to the wiki, let me know if you
need any further information!

On Sun, Sep 23, 2012 at 2:41 PM, Robby Russell notifications@github.comwrote:

Thanks Jim, could you add some details to the Plugins wiki page for us?

@wprater
Copy link

wprater commented Oct 31, 2012

Im using this plugin in combination with history_substring_search and it (mostly) works great. However, when in the local directory scope, but the substring search appears to be searching duplicates.

I have the setopt hist_ignore_dups option set.

Ideas?

Also with a two line prompt, I need to change the echo statements to something like this, otherwise they disappear.

function per-directory-history-toggle-history() { if [[ $_per_directory_history_is_global == true ]]; then _per-directory-history-set-directory-history echo "using local history\n\n" else _per-directory-history-set-global-history echo "using global history\n\n" fi zle reset-prompt }

@jimhester
Copy link
Contributor Author

The prompt overwriting was due to a vi-mode bug, my commit above fixes that.

I also use the per-directory-history and history_substring_search plugins, and I do not get any duplicates, I am not sure what is causing it on your end, but it is not that combination of plugins.

chrodan pushed a commit to chrodan/oh-my-zsh that referenced this pull request Oct 30, 2013
fixes ohmyzsh#387 and ohmyzsh#1321 (comment)
and other problems of prompt overwriting when people did not realize that it
was vi mode causing the problem.  Hat tip to sorin ionescu, as I took this code
from prezto
kenton pushed a commit to kenton/oh-my-zsh that referenced this pull request Jan 9, 2015
fixes ohmyzsh#387 and ohmyzsh#1321 (comment)
and other problems of prompt overwriting when people did not realize that it
was vi mode causing the problem.  Hat tip to sorin ionescu, as I took this code
from prezto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants