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

!$ history subsitution command not expanding last parameter #2263

Closed
jbelmont opened this issue Nov 18, 2013 · 9 comments
Closed

!$ history subsitution command not expanding last parameter #2263

jbelmont opened this issue Nov 18, 2013 · 9 comments

Comments

@jbelmont
Copy link

Hello all:

This is my first post here so I apologize if I breaking submission rules. I am running zsh 5.0.2 on Mac OS X 10.7. I am having the issue that whenever try to do history substitution it is not behaving as expected.
For example if I execute these commands:
echo Hello World
echo !$ ==> expands to echo echo Hello World
instead of the expected Behavior of echo World.
In my zshrc I have the following oh my zsh plugins activated, setopt options and styles specified:

plugins=(vi-mode urltools web-search brew cpanm dircycle fabric osx rsync textmate torrent screen ruby mercurial perl colorize colored-man python
history-substring-search compleat copydir git-extras git-hubflow github git-flow git git-hubflow ssh-agent themes osx fasd per-directory-history
zsh-syntax-highlighting gitignore git-flow-avh tmux
)

setopt auto_cd #Change directory by typing a directory name on its own.
setopt extended_glob #Turn on the more powerful pattern matching features.
setopt no_prompt_cr # No carriage return at start of prompt
setopt vi # set mode in zsh to vi
setopt no_hist_verify # stops zsh from expanding !! notation when you hit enter
setopt bang_hist # enable history subsitutions
setopt hist_ignore_dups # ignore history duplicate

And set some styles...

zstyle ':completion:' completer complete approximate
zstyle ':completion:
:descriptions' format "- %d -"
zstyle ':completion:
:corrections' format "- %d - (errors %e})"
zstyle ':completion:
:default' list-prompt '%S%M matches%s'
zstyle ':completion:' group-name ''
zstyle ':completion:
:manuals' separate-sections true
zstyle ':completion::manuals.(^1)' insert-sections true
zstyle ':completion:' menu select
zstyle ':completion:
' verbose yes
zstyle ':completion:' rehash yes
zstyle -e ':completion:
:approximate:*' max-errors 'reply=( $(( ($#PREFIX + $#SUFFIX) / 3 )) )'

How can I get the normal history behavior working again?

@mcornella
Copy link
Member

Hi @jbelmont, you should narrow down the source of the issue first. For example, use the zshrc template file to see if it's caused by oh-my-zsh or your zshrc file; if the latter, disable plugins or setopts or completion options as a whole, then disable some of them, then one by one, etc.
You may want to clean up your plugins too; for starters I see you have git-hubflow twice.

@jbelmont
Copy link
Author

jbelmont commented Feb 2, 2014

Yes I found out that the problem was with the fasd plugin with oh my zsh.
Once I disabled it history substitution was working as expected.

@mcornella
Copy link
Member

Nice! I'll check out if it needs to be fixed thanks!
Remember to close the issue 😉

@mcornella
Copy link
Member

Hi, just checked it to see if the fasd plugin was at fault, but I couldn't find any problems with it. Instead, I think the plugin at fault was per-directory-history, which you enabled immediately after fasd; so you probably mistook it for the other.
Please check if I'm correct; in that case, that's the plugin that has to be checked out.
Cheers

@mcornella
Copy link
Member

I've narrowed it down. If you comment the content of the function _per-directory-history-addhistory inside the file per-directory-history.plugin.zsh (line 110) the expected behaviour returns. I have read the man page about zshaddhistory, but I don't know enough to understand why it fails. Maybe the mantainer can help shed some light on this.
cc @jimhester

@jimhester
Copy link
Contributor

This is a known/fixed issue in the actual per-directory-history repo

jimhester/per-directory-history#1

If you use the latest version from

https://github.com/jimhester/per-directory-history

You will not have the problem. The changes have just never been put back into oh-my-zsh. I had a pull request to do that, but it has not been merged.

Sorry you are having the issue, thank you @mcornella for tracking down the cause and pinging me, I would never had been aware of this if you had not.

@mcornella
Copy link
Member

Haha this is insane, the pull request is from 1 year ago!
FWIW, the mentioned PR is #1635. I'll make sure to +1 that, see if it gets merged.

PS. the actual fix on the plugin is changing -s for -S in line 111. I can confirm that it works

@mcornella
Copy link
Member

PR #1635 has been merged, @jbelmont please update oh-my-zsh and close this PR if it's solved.

@jbelmont
Copy link
Author

Sorry for the late response back. I will update oh-my-zsh and close this PR.

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

3 participants