olets / zsh-abbr

The zsh manager for auto-expanding abbreviations, inspired by fish. ~13,000 unique cloners as of May '24, 580+ Homebrew installs 6/23-6/24
https://zsh-abbr.olets.dev
Other
517 stars 18 forks source link

Do not follow aliases when calling system commands #13

Closed allisio closed 4 years ago

allisio commented 4 years ago

I recently discovered a really nice ls replacement. Naturally, I did an alias ls=exa straight away... and my next terminal hung like crazy.

It turns out the problem is in _zsh_abbr_job_push:next_job_id(), where the behavior of ls -t is assumed to be constant. Unfortunately, exa's -t flag works very similarly, but doesn't have a default.

A straightforward fix would be to use \ls instead, but I don't know how that meshes with the project's practices.

olets commented 4 years ago

Thanks for the report!

alias ls=exa

Brave! But it's a good point, ls is particular is one people like to alias in order to add default options.

use \ls instead

Wrapping system commands to prevent the use of aliases would be a maintainable solution. I have a picture of how it'll work, will look for time in the next week.

olets commented 4 years ago

Done! Let me know if you have more trouble. Thought I might wrap all system commands, but decided to just address ls for now.

allisio commented 4 years ago

That should definitely do it. In the meantime, I realized it would make more sense to just source my aliases at the end of my zshrc, but this looks like a very robust approach to handling "brave" aliasing. :sweat_smile:

Thanks!

olets commented 2 months ago

Belatedly recognizing bug reporters in https://github.com/olets/zsh-abbr#community and https://zsh-abbr.olets.dev/community/. would you like to be added @allisio?