Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Best practices for managing aliases in ohmyzsh?



On Tue, Aug 31, 2021 at 1:23 AM Steve Dondley <s@xxxxxxxxxxx> wrote:
>
> Now you've got me wondering. While I was bumbling around today, I
> noticed I had an ~/.oh-my-zsh/.zshrc file.

This is unexpected. Oh My Zsh installer does not create this file.

> I'm only using the ~/.zshrc file, though. It has just one line:
> ZSH_THEME="powerlevel9k/powerlevel9k". I'm guessing that's the
> default because I don't remember editing it.

The default theme in Oh My Zsh is "robbyrussell". powerlevel9k is not
included in Oh My Zsh. The fact that you are using it means you've
installed it separately (or copied a config from someone else who
did).

Note that development of powerlevel9k has been discontinued and the
project has been archived.

On Tue, Aug 31, 2021 at 3:30 AM Steve Dondley <s@xxxxxxxxxxx> wrote:
>
> Right. I had hunted around for an ohmyzsh list but didn't find one (but
> if you know of one, let me know).

Oh My Zsh uses Discord for questions and discussions of this kind. You
can find a link at https://ohmyz.sh/.

> > In general, zsh will not run bash code 100% correctly unless it is
> > written *extremely* portably.  Your old functions almost certainly
> > need to be tweaked to one degree or another.
>
> My functions are very simple so I haven't run into any problems yet. But
> I will definitely keep this in mind going forward.

This suggests that all or at least most of your functions could be
scripts instead. Place each one in a separate executable file in a
directory in your PATH (~/bin is a common choice), slap a shebang on
each and you are good to go. This way you can use your utilities from
any shell and won't have to port them whenever you switch shells.
Since these utilities are proven to work in bash, use `#!/usr/bin/env
bash` as shebang. You *can* also make them auto-loadable functions in
zsh but you probably shouldn't. The only advantage would be that
they'll execute faster but that matters only in rare special cases.
The disadvantage is that you would have to port your scripts to zsh,
make sure they can run with various shell options, don't pollute
interactive shell environment, etc,

Roman.




Messages sorted by: Reverse Date, Date, Thread, Author