Closed tekhnee closed 3 years ago
Every command line? That’s weird. Can you please try the following?
$ cd $(mktemp -d) # Create a temp dir and enter it.
$ ZDOTDIR=$PWD HOME=$PWD zsh -f # Start a subshell in it without config files.
% source path/to/zsh-hist.plugin.zsh # Source the plugin.
% # Insert here the steps you take to reproduce your bug.
Does the problem occur then, too?
@marlonrichert thank you for these troubleshooting steps.
Indeed, sourcing the plugin within a pristine shell suppresses the issue.
I'll try to identify the conflicting plugin—if I understand your intention correctly—and report back.
UPDATE: The issue persists with the following bare-bones .zshrc
:
export ZPLUG_HOME=~/.zplug
source $ZPLUG_HOME/init.zsh
zplug "marlonrichert/zsh-hist"
zplug load
In tandem with your troubleshooting steps above, this suggests that a conflict between zplug and zsh-hist is likely.
(Have been troubleshooting with both iTerm2 and Terminal.app on a Mac.)
Thanks for the info! I’ll have a look at what could be the problem.
Sorry, but I cannot reproduce this. Here's what I did:
> brew install zplug
> cd "$(mktemp -d)"
> ZDOTDIR=$PWD HOME=$PWD PS1='%~:%?> ' PS4='+%e %N:%I %?> %_ ' zsh -f
% export ZPLUG_HOME=/usr/local/opt/zplug
% source $ZPLUG_HOME/init.zsh
% zplug "marlonrichert/zsh-hist"
% zplug load
And then I tried out different kinds of commands. They all work correctly for me.
@marlonrichert hmm… I'm not surprised. The issue is profoundly puzzling. Removing zsh-hist from my plugins list instantly fixes it. (Of course this doesn't prove that zsh-hist is responsible for it!)
Deliberately prefixing a command with N tab characters (N > 1), it is still stored in the history with exactly one tab character. So the bug does not add a tab character before each command line; it rather "massages" the command line with a single-tab prefix—just as one would go about indenting a line. This is why I hypothesized, for a moment, that HIST_REDUCE_BLANKS
might be to blame; but no…
Any further thoughts would be much appreciated, though I realize that this might be specific to my setup.
Can you please do functions -T .hist.format
, try again and paste the debug out here?
@marlonrichert here you go (testing with a plain ls
command at the prompt). I can see several suspects… Your expertise is much appreciated.
ls+.hist.format:1> setopt localoptions
+.hist.format:2> zstyle -t :hist: expand-aliases
+.hist.format:5> setopt NO_aliases
+.hist.format:7> REPLY=ls
+.hist.format:8> local -i ret=1
+.hist.format:10> functions[.tmp.]=ls
+.hist.format:11> [[ -n $'\tls' ]]
+.hist.format:12> REPLY='' ft+Tab to insert)
+.hist.format:13> local word chunk body=$'\n\tls'
+.hist.format:14> word=ls
+.hist.format:15> chunk=$'\n\tls'
+.hist.format:16> body=''
+.hist.format:17> prefix=$'\n\t'
+.hist.format:18> indent=''
+.hist.format:19> REPLY+=$'\n\tls'
+.hist.format:21> REPLY=$'\tls'
+.hist.format:22> ret=0
+.hist.format:25> [[ -v 'functions[.tmp.]' ]]
+.hist.format:26> unfunction .tmp.
+.hist.format:28> return ret
ls
./
../
<…etc.>
UPDATE: I migrated my zsh
from zplug
to zsh-snap
. It was worth every minute, but this particular issue persists.
@tekhnee If you do setopt extendedglob
and then try again, does the problem go away?
@marlonrichert I meant to say that migrating was *worth every minute.
And yes indeed, setopt extendedglob
does the trick — thank you! Is this option required by zsh-hist
?
And yes indeed,
setopt extendedglob
does the trick — thank you! Is this option required byzsh-hist
?
No, it just means I need to set it inside the function. 🙂
Should be fixed now.
Thank you for yet another excellent plugin.
Curiously, the plugin seems to cause the prepending of every command with a tab character (
\t
).This tab is inserted both in the command line (upon pressing Enter) and in the history (as confirmed by
hist l
).Any thoughts as to what the reason might be? Thank you once again.