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

fish_prompt event function doesn't have an updated $history variable #1098

Closed
naelstrof opened this issue Nov 6, 2013 · 2 comments
Closed

Comments

@naelstrof
Copy link

Description:
When attempting to access the last command in a fish_prompt-event-driven function: it gets the second to last command instead. This makes abbreviating "!!" not work properly.

Steps to Reproduce:
Place the following in ~/.config/fish/config.fish

function -e fish_prompt onprompt
    set -U fish_user_abbreviations "!!=$history[1]"
end

Then try typing !!, followed by a space. Then witness that instead of being replaced by the last command, !! is replaced by the second-to-last command.

Additional Information:
I'm guessing the fish_prompt event is launched before the variable $history is updated.

@zanchey
Copy link
Member

zanchey commented Nov 7, 2013

Yes, others have noticed this too. Does #984 describe things adequately?

@naelstrof
Copy link
Author

Oops. Yes it does. Feel free to close this.

@zanchey zanchey closed this as completed Nov 9, 2013
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants