zsh-users
 help / color / mirror / code / Atom feed
From: Michael Klemm <michael@dontknow.de>
To: Zsh users <zsh-users@zsh.org>
Subject: Re: Best practices for managing aliases in ohmyzsh?
Date: Wed, 1 Sep 2021 08:40:16 +0200	[thread overview]
Message-ID: <b62fe32d-8dff-8b97-7786-380e823316e8@dontknow.de> (raw)
In-Reply-To: <41fa241f119fdb9b8598293aad345823@dondley.com>

[-- Attachment #1: Type: text/plain, Size: 2533 bytes --]

Hi Steve,

On 30.08.2021 20:13, Steve Dondley wrote:
> I switched to zsh last week and learning the ropes. My .zshrc is quickly 
> growing out of hand.

I basically went all-in on the Oh My Zsh approach and created my own 
theme and my own set of plugins.  I basically have this:

orcus ~ [0:0]> \ls -d .oh-my-zsh.custom/*
.oh-my-zsh.custom/oh-my-zsh.custom.sh
.oh-my-zsh.custom/plugins
.oh-my-zsh.custom/themes
.oh-my-zsh.custom/tools

I have my own theme "mklemm" that defines the prompt style and the 
general behavior of my Zsh instances.

The plugins folder then has a few plugins that I wrote to easily absorb 
different machines (or where I create a "fork" of the original Zsh 
plugin for myself):

orcus ~ [0:0]> \ls -d .oh-my-zsh.custom/plugins/*
.oh-my-zsh.custom/plugins/anaconda
.oh-my-zsh.custom/plugins/autosuggestions
.oh-my-zsh.custom/plugins/conda-zsh-completion
.oh-my-zsh.custom/plugins/direnv
.oh-my-zsh.custom/plugins/extract
.oh-my-zsh.custom/plugins/fastfile
.oh-my-zsh.custom/plugins/fritzbox
.oh-my-zsh.custom/plugins/history-search-multi-word
.oh-my-zsh.custom/plugins/k
.oh-my-zsh.custom/plugins/mklemm
.oh-my-zsh.custom/plugins/slurm
.oh-my-zsh.custom/plugins/zsh-completions
.oh-my-zsh.custom/plugins/zsh-syntax-highlighting

In my .zshrc, I then have this:

if [[ -e "${HOME}/.myzshrc.local.zsh" ]]; then
     source "${HOME}/.myzshrc.local.zsh"
fi
export ZSH_CUSTOM="${HOME}/.oh-my-zsh.custom"
export ZSH_THEME="mklemm"

plugins=(
   autosuggestions
   colorize
   [...]
   $local_plugins
)

source $HOME/.oh-my-zsh.custom/oh-my-zsh.custom.sh
source $HOME/.oh-my-zsh/oh-my-zsh.sh

The way this works is that if there's a "${HOME}/.myzshrc.local.zsh" it 
is sourced and does some machine-specific adjustments that are not 
contained in the general .zshrc file.  That local script can also set 
local_plugins to a list with plugins that I only want/need on that 
machine (e.g., a plugin to work with the SLURM job scheduler on an HPC 
system).


> Now I'm wondering if there is some similar mechanism for adding aliases 
> with ohmyzsh. 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?

Most aliases with Oh My Zsh are coming from plugins, so my mklemm plugin 
has an alias.sh file that defines that aliases that I want on top of 
those imported from all the plugins.


Kind regards,
         -michael




[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3542 bytes --]

  parent reply	other threads:[~2021-09-01  6:41 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
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 [this message]
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=b62fe32d-8dff-8b97-7786-380e823316e8@dontknow.de \
    --to=michael@dontknow.de \
    --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).