bevry / dorothy

🧙🏻‍♀️ Bring your dotfile commands and configuration to any shell. Sensible defaults and hundreds of commands preloaded. Supports Bash, Zsh, Fish, Nu, Xonsh, Elvish, Dash, KornShell, macOS, Linux, Windows.
Other
277 stars 21 forks source link

Suggestion: Cross-shell aliases #226

Closed edmcman closed 1 month ago

edmcman commented 1 month ago

Is there a suggested way to add cross-shell aliases? I use fish, so right now I put them in both interactive.fish and interactive.sh which is annoying...

balupton commented 1 month ago

Many shells, including fish will support sourcing basic POSIX files, ie. I'm a fish shell user, but only have interactive.sh without an interactive.fish: https://github.com/balupton/dotfiles/blob/master/config/interactive.sh

Try sourcing your interactive.sh file in your interactive.fish file, and if there is say a function or the like inside it which prevents fish compatibility, move the aliases out into an aliases.sh file which is sourced by interactive.sh and interactive.fish

For the long term, perhaps Dorothy could support say a aliases.json file, which then injects the aliases into each shell, or even better, a define_alias function implemented for each shell: https://github.com/bevry/dorothy/issues/173

edmcman commented 1 month ago

Thanks, I actually looked at your dotfile and didn't realize your aliases were imported to fish.

For now I'll split my aliases into a separate file since I have some stuff in interactive.sh that fish doesn't like.