-
Notifications
You must be signed in to change notification settings - Fork 18
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
Evaluate subshells in EXPANSION #26
Comments
Thanks for the idea! At this time I'm not comfortable supporting evaluation in that way. Seems like a vector for easy abuse. If you just need the result, you can use the default expand-and-accept behavior abbr -g gr="git rev-parse --show-cdup"
gr If you need to use the result in a command and don't care about seeing the full text of the command, that's a good use case for an alias % alias -g gr="git rev-parse --show-cdup"
% cd my-repo/dir
% gr
../
% cat $(gr)README.md
# snip
% cd $(gr) I see the limitation if you do want to see the full command and it needs to not be followed by a space, for example in the above abbr -g gr='$(git rev-parse --show-cdup)'
gr<Space><Delete>README.md<Enter> which is okay but it'd be nice to document a way of expanding in place, without having to delete a space: abbr -g gr='$(git rev-parse --show-cdup)'
gr<some binding>README.md<Enter> I'll plan on adding that feature. p.s. nice GH landing page! |
I'll try to workaround it for now. Thank you for your reply 😉 |
Added some friendlier widget names, see https://github.com/olets/zsh-abbr#bindings Closing but let me know if that doesn't meet your needs |
I'd like to define abbr as follows.
abbr add --quiet -g gr='$(git rev-parse --show-cdup)'
ref:
https://github.com/momo-lab/zsh-abbrev-alias#help
-e, --eval evaluates subshells on expansion.
The text was updated successfully, but these errors were encountered: