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

Switch back to global history doesn't work #1

Open
tmpm697 opened this issue Nov 20, 2019 · 7 comments
Open

Switch back to global history doesn't work #1

tmpm697 opened this issue Nov 20, 2019 · 7 comments

Comments

@tmpm697
Copy link

tmpm697 commented Nov 20, 2019

Test:
get default per-directory-history.zsh from this repo and load it,

open terminal and type something, press alt-l to switch back and forth between global and local history, I don't see global history there.

global history I mean, commands in history file in that I put under ~/.cache/zsh/zsh_history @CyberShadow

I find that the jimhester/per-directory-history works.

@CyberShadow
Copy link
Owner

What other history options do you have set?

@tmpm697
Copy link
Author

tmpm697 commented Nov 20, 2019

setopt:

autocd
autopushd
nobeep
extendedglob
extendedhistory
nohistbeep
histignorealldups
histignoredups
histnofunctions
histnostore
histsavenodups
histverify
ignoreeof
incappendhistory
interactive
interactivecomments
login
monitor
nonotify
nullglob
promptsubst
pushdignoredups
pushdminus
pushdsilent
pushdtohome
rmstarsilent
sharehistory
shinstdin
zle

@CyberShadow

@CyberShadow
Copy link
Owner

And what about HISTFILE etc.?

Better yet, can you provide steps to reproduce starting with e.g. env -i TERM=$TERM zsh -f?

@tmpm697
Copy link
Author

tmpm697 commented Nov 20, 2019

env -i TERM=$TERM zsh -f
export HISTFILE=~/.cache/zsh/zsh_history
export HISTSIZE=50000000
export SAVEHIST=50000000
export LESSHISTFILE=-

There's no old command in zsh_history loaded when global is enabled.

@CyberShadow
Copy link
Owner

CyberShadow commented Nov 20, 2019

Works for me:

$ mkdir -p .cache/zsh
$ echo test > .cache/zsh/zsh_history
$ env -i HOME=$PWD TERM=$TERM zsh -f
localhost% export HISTFILE=~/.cache/zsh/zsh_history
export HISTSIZE=50000000                      
export SAVEHIST=50000000
export LESSHISTFILE=-
source /home/vladimir/.config/oh-my-zsh/plugins/per-directory-history/per-directory-history.plugin.zsh

Pressing Alt+L:

using global history

Now pressing the up arrow key correctly recalls test from the global history file.

@tmpm697
Copy link
Author

tmpm697 commented Nov 20, 2019

Yes, it works as I simulate your steps, but somehow my current zsh configs won't work, zsh doesn't pull commands in zsh_history when enable global.

Is there any clues that would stop it working?

@CyberShadow
Copy link
Owner

You could try to narrow it down by either bisecting (whittling down) your config to a minimal one, or by trying to debug the plugin code directly to see what it / ZSH is doing.

If it helps, here's my settings:

$ setopt | grep hist   
extendedhistory
histexpiredupsfirst
histfindnodups
histignoredups
histignorespace
histverify
incappendhistory
sharehistory

$ set | grep HIST   
HISTCHARS='!^#'
HISTCMD=820
HISTFILE=/home/vladimir/.zsh_history_dirs/home/vladimir/zsh-per-directory-history
HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS=i
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
HISTSIZE=1000000
PER_DIRECTORY_HISTORY_BASE=/home/vladimir/.zsh_history_dirs
PER_DIRECTORY_HISTORY_FILE=zsh-per-directory-history
PER_DIRECTORY_HISTORY_TOGGLE='\el'
SAVEHIST=1000000
_per_directory_history_last_cmd='set | grep HIST'

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

No branches or pull requests

2 participants