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

Consider expanding history as part of the parser #452

Open
andychu opened this issue Jul 29, 2019 · 3 comments
Open

Consider expanding history as part of the parser #452

andychu opened this issue Jul 29, 2019 · 3 comments

Comments

@andychu
Copy link
Contributor

andychu commented Jul 29, 2019

This isn't the way bash does it, but #451 made me think that this might be a good idea. (We copied bash's strategy of doing an entirely separate preprocessing/lexing phase.)

And I think it's pretty easily possible.

Comments aren't purely lexical because of echo x#notcomment and echo 'x'#notcomment, etc.

notes: in bash, history is expanded in double quotes, NOT in single quotes, and NOT in comments.

We can easily implement that rule. (Although honestly I don't see a use case for it being expanded in double quotes...)

$ echo hi
hi
$ echo "!!"
echo "echo hi"
echo hi
@andychu
Copy link
Contributor Author

andychu commented Sep 1, 2019

A few people mentioned here that they don't like that history is expanded within double quotes like "!!", which I agree with. If we do it as part of the parser it would fix that problem.

https://lobste.rs/s/l2fk5f/seven_god_like_bash_history_shortcuts_you

@andychu
Copy link
Contributor Author

andychu commented Sep 1, 2019

Also relevant to history:

zsh has hist_verify, which shows the result of history replacements/substitutions, and makes you hit enter again before execution. Seems like a nice middle ground between “blind” and TUI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant