Per directory history plugin #1321

Merged
merged 2 commits into from Sep 23, 2012

Conversation

Projects
None yet
4 participants
Contributor

jimhester commented Sep 20, 2012

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

jimhester added some commits Sep 20, 2012

@jimhester jimhester Per directory history plugin
   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
baa187e
@jimhester jimhester Use HISTFILE evironment variable directly rather than copying it
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
cc83150
Owner

robbyrussell commented Sep 23, 2012

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

@robbyrussell robbyrussell added a commit that referenced this pull request Sep 23, 2012

@robbyrussell robbyrussell Merge pull request #1321 from jimhester/per-directory-history
Per directory history plugin
523b26c

@robbyrussell robbyrussell merged commit 523b26c into robbyrussell:master Sep 23, 2012

Contributor

jimhester commented Sep 24, 2012

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 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 }

Contributor

jimhester commented Nov 2, 2012

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 chrodan pushed a commit to chrodan/oh-my-zsh that referenced this pull request Oct 30, 2013

@jimhester jimhester Fixes for vi-mode terminal overwriting bugs
fixes #387 and robbyrussell#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
4e513d7

@w31 w31 pushed a commit to w31/oh-my-zsh that referenced this pull request Apr 30, 2014

@robbyrussell robbyrussell Merge pull request #1321 from jimhester/per-directory-history
Per directory history plugin
bef16a3

@w31 w31 pushed a commit to w31/oh-my-zsh that referenced this pull request Apr 30, 2014

@jimhester jimhester Fixes for vi-mode terminal overwriting bugs
fixes #387 and robbyrussell#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
1862b14

@yfrancis yfrancis added a commit to yfrancis/oh-my-zsh that referenced this pull request Aug 15, 2014

@jimhester @yfrancis jimhester + yfrancis Fixes for vi-mode terminal overwriting bugs
fixes #387 and robbyrussell#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
f12db80

@kenton kenton added a commit to kenton/oh-my-zsh that referenced this pull request Jan 9, 2015

@jimhester @kenton jimhester + kenton Fixes for vi-mode terminal overwriting bugs
fixes #387 and robbyrussell#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
154574f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment