momo-lab / zsh-abbrev-alias

This zsh plugin provides functionality similar to Vim's abbreviation expansion.
MIT License
119 stars 14 forks source link

Implement eager evaluation of subshells #3

Closed zk-phi closed 5 years ago

zk-phi commented 5 years ago

This PR adds a new option -e to allow zsh-abbrev-alias to execute subshells eagerly on expansion, like -f.

Example of the current behavior:

$ abbrev-alias gpu='git pull origin $(git symbolic-ref --short HEAD 2>/dev/null) --ff-only'
$ gpu[SPC]
-> git pull origin $(git symbolic-ref --short HEAD 2>/dev/null) --ff-only

and the proposed behavior:

$ abbrev-alias -e gpu='git pull origin $(git symbolic-ref --short HEAD 2>/dev/null) --ff-only'
$ gpu[SPC]
-> git pull origin feature/eager-subshell-expansion --ff-only
momo-lab commented 5 years ago

This is good idea! But I'm thinking of a different implementation, so please wait for the merge.

momo-lab commented 5 years ago

I want to support "-g -e" similar to -f. And I want to deprecate -f. By doing so, functionality consistency is maintained.

An example that is not good:

$ abbrev-alias -g -e OB='origin $(git symbolic-ref --short HEAD 2>/dev/null)'
$ git pull OB[SPC]
-> git pull origin feature/eager-subshell-expansion
momo-lab commented 5 years ago

It responded by another method. Look at # 6. So this PR does not merge.