zsh-users
 help / color / mirror / code / Atom feed
From: "Lawrence Velázquez" <larryv@zsh.org>
To: "Steve Dondley" <s@dondley.com>
Cc: zsh-users@zsh.org
Subject: Re: Best practices for managing aliases in ohmyzsh?
Date: Mon, 30 Aug 2021 20:14:52 -0400	[thread overview]
Message-ID: <c6227471-d010-42da-84e7-08d7a5a8f683@www.fastmail.com> (raw)
In-Reply-To: <776abe09c579095258b2eef28a7ad5ca@dondley.com>

On Mon, Aug 30, 2021, at 7:22 PM, Steve Dondley wrote:
> >> Now I'm wondering if there is some similar mechanism for adding 
> >> aliases with ohmyzsh.

Note that oh-my-zsh is a separate project that is not affiliated
with this one.  There might be someone on this list who is familiar
with how it works, but it's hardly a guarantee.

> >> If not, what's everyone else doing who has a 
> >> couple hundred aliases. Are you just throwing them all into .zshrc or 
> >> doing something to help manage all your aliases?
> 
> > I'm the least qualified guy on the list, but I can tell you that you
> > can take advantage of all the built in complexities that zsh offers or
> > you can make it as dead simple as you desire.  

I don't use any aliases, and only a couple of functions.  But, as
Ray said, you can organize things however you like.  One rudimentary
method is to just separate your alias definitions into their own
file and source it from $ZDOTDIR/.zshrc:

    ### $ZDOTDIR/zsh_aliases ###
    alias foo='one thing'
    alias bar='another thing'

    ### $ZDOTDIR/.zshrc ###
    . $ZDOTDIR/zsh_aliases

Going further, you could use multiple files, organize them in a
directory hierarchy, etc.

> Yes, I spent about 2 hours today figuring out how to get my old bash 
> functions automatically loaded. Previously, I was just using 'source' to 
> load the old bash files which, from what I gathered, is not the best way 
> with zsh.

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.

> Now you've got me wondering. While I was bumbling around today, I 
> noticed I had an ~/.oh-my-zsh/.zshrc 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.

I don't use any zsh configuration frameworks, but in my experience
they don't love it when you work with one foot inside their black
box and the other outside of it.

> So what is the "real" .zszhrc supposed to be?

Whatever you want it to be.  The distribution usually includes the
"zsh-newuser-install" function, which is intended to interactively
guide you through creating a .zshrc file.

https://zsh.sourceforge.io/Doc/Release/User-Contributions.html#User-Configuration-Functions


-- 
vq


  parent reply	other threads:[~2021-08-31  0:16 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 18:13 Steve Dondley
2021-08-30 22:27 ` Ray Andrews
2021-08-30 23:22   ` Steve Dondley
2021-08-30 23:34     ` Ray Andrews
2021-08-31  1:44       ` Steve Dondley
2021-08-31  0:14     ` Lawrence Velázquez [this message]
2021-08-31  1:29       ` Steve Dondley
2021-08-31  8:26     ` Roman Perepelitsa
2021-08-31 15:51       ` Steve Dondley
2021-08-31 17:57         ` Roman Perepelitsa
2021-08-31 18:54           ` Bart Schaefer
2021-08-31 21:22           ` Steve Dondley
2021-08-31 21:36             ` Roman Perepelitsa
2021-08-31 21:43               ` Steve Dondley
2021-08-31 21:44             ` Roman Perepelitsa
2021-09-01  0:12           ` Ray Andrews
2021-09-01  0:28             ` Bart Schaefer
2021-09-01  2:33               ` Ray Andrews
2021-09-01  3:01                 ` Bart Schaefer
2021-09-01 14:20                   ` Daniel Shahaf
2021-09-01 15:58                   ` Ray Andrews
2021-09-01 18:22                     ` Lawrence Velázquez
2021-09-01 19:11                       ` Ray Andrews
2021-09-01 19:16                         ` Bart Schaefer
2021-09-01 19:56                           ` Ray Andrews
2021-09-01 20:03                             ` Bart Schaefer
2021-09-01 20:52                               ` Steve Dondley
2021-09-01 21:06                                 ` Ray Andrews
2021-09-01 22:06                                   ` Steve Dondley
2021-09-01 20:53                               ` Lawrence Velázquez
2021-09-01 21:11                                 ` zeurkous
2021-09-01 21:19                                   ` Bart Schaefer
2021-09-01 21:29                                     ` Lawrence Velázquez
2021-09-01 21:23                                 ` Ray Andrews
2021-09-01 21:05                               ` Ray Andrews
2021-09-01  3:19                 ` Steve Dondley
2021-09-01  3:30                   ` Bart Schaefer
2021-09-01  3:27                 ` Lawrence Velázquez
2021-09-01 16:20                   ` Ray Andrews
2021-09-01 18:34                     ` Lawrence Velázquez
2021-09-01 19:19                       ` Ray Andrews
2021-08-31  8:06 ` Anssi Saari
2021-08-31 15:45   ` Steve Dondley
2021-08-31 16:24 ` zzapper
2021-08-31 16:47   ` Steve Dondley
2021-08-31 17:20     ` Steve Dondley
2021-08-31 17:26     ` Bart Schaefer
2021-08-31 17:40       ` Steve Dondley
2021-08-31 17:47       ` Steve Dondley
2021-08-31 18:31         ` Ray Andrews
2021-08-31 18:59         ` Lawrence Velázquez
2021-09-01  6:40 ` Michael Klemm
2021-09-01 22:13   ` Steve Dondley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c6227471-d010-42da-84e7-08d7a5a8f683@www.fastmail.com \
    --to=larryv@zsh.org \
    --cc=s@dondley.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).