From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30616 invoked from network); 31 Aug 2021 15:52:37 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 31 Aug 2021 15:52:37 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630425157; b=iQkttFSrhILAe9GV3dD4XZy8eESWodswLEn9vw1nrSeAA6cs72mPSphobjd8k8OYHll/Ig/4+k NaQnC5xRe8j4X2WGUNR9VsdXQPpr4LlHG9V8xFQpJbagCYhBZVd9YBFOviRGZgJe+Abvqa4O4c ZZ4geejLfhzxHlS6/G2gjliuy9FZD9eBVSIjuRJL1vRsJJZZ07U9OXRzBCyB2S2LQVB7txFHkx 7clPlGyyShWpjQ5a6B0Acm+1jbV0cyigt9mY++vYzfX9OdAICuHF+YyUIsPRZdAXRyhbOmASm2 cUs1NoSmu5h+yC3ulKt78HxARfbvcUJvq61htHhZQXRiVg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (email.dondley.com) smtp.remote-ip=34.203.132.18; dkim=pass header.d=dondley.com header.s=default header.a=rsa-sha256; dmarc=pass header.from=dondley.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1630425157; bh=tOBmQAOehypKqSsJDIz6SFy6Kg7fBJWJ+9tpZzmaiFU=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Message-ID:References: In-Reply-To:Subject:To:From:Date:MIME-Version:DKIM-Signature:DKIM-Signature; b=Lrdt5ugr2LRTQGXXa7UrPl6GJdWKXt5bAD8RDRQpKfgTqDb+jUSIezm6vLnanfySjAPhqzip+e 7TA1eZGyZWoJEiFcauO3Vj+PVTxKjqmxIH9nLG1yk3YO6hLC0mlP4KGUo7UL4M7+TK3WXwdO3E dgW2aQaTcxffAzwiMODl5iYh4FNhVAxGwkyE+HSheaeGfMtNRNCR4Uhgb8/nUy7r9R4s4bf25P 1yPAsMoBDdQNMOKzc8dF5CkTrIkm5+K/uYh92FOOqmuEF3fTPHDgOc/Y0D215nA3diUFUPXWoP AutymRIdTgpFkA4P0HKq88Ps+bGOCKDnRbTrvrC0IFhG1w==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:Message-ID:References:In-Reply-To:Subject:To:From:Date: MIME-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=WeFpLIT0HRb2dn81ALgTweorZUEmT2K8Sd9ysOlL8T4=; b=X8PmkUIFgIogXucytoZ2L7qPEa AHBlbtEJ+f4sENy5gr0o0yqCMTJFeMiQ9ej76zYOl9S+R6DzSk1si2sraP2GpVtC7suaKiLTeROVp 1LPMy1eBTdF6LnVLHeDIRI8cHocTX0Z1eO8pZ6sj2dtR2MB01FVAJjZ92uc7hk0d+zOO+8S5yhRFo f0LLITCaelWMcSadt7aGrT/wkv1cv4cX9FIO8DZn/tr0oBBbcaeu/WjjpKTT0syVTKODPrF8EJxN6 ZwTK54d8pulIW3bKM9eAEYTpD1OmSTbUu0IXUOjjV6jRRuSIqQJXtkI3jhA1rIk8Hx76lLFzPs/TW fvdeWnMA==; Received: from authenticated user by zero.zsh.org with local id 1mL63x-000LfT-Ak; Tue, 31 Aug 2021 15:52:37 +0000 Authentication-Results: zsh.org; iprev=pass (email.dondley.com) smtp.remote-ip=34.203.132.18; dkim=pass header.d=dondley.com header.s=default header.a=rsa-sha256; dmarc=pass header.from=dondley.com; arc=none Received: from email.dondley.com ([34.203.132.18]:35860) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mL63C-000KwS-Dh; Tue, 31 Aug 2021 15:51:51 +0000 Received: from email.dondley.com (email.dondley.com [34.203.132.18]) by email.dondley.com (Postfix) with ESMTPSA id 2DFFD208B3 for ; Tue, 31 Aug 2021 11:51:49 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dondley.com; s=default; t=1630425109; bh=tOBmQAOehypKqSsJDIz6SFy6Kg7fBJWJ+9tpZzmaiFU=; h=Date:From:To:Subject:In-Reply-To:References:From; b=jkG38kzBa1UcJpnVQJ1iqDf8rJWScvRSBeEMq0wrFsIeBEJuS3B2oluJFCJMOelIR KCYB022Qen/0UPM6sI0eMCJErIuWBeto25XBER+l6iBhX5c6bYHih74POdsIifcCfq cCzMeVBCQch+A6ZcYCZWjlJjIvVeHnUNCsLK8MUT+kKb1zSGYqJXhPp4PAeeKxHjLj F33AygJhQi4plz6g03zRff1ArI2JTF614Z6bzUfqI2yMmGJCGKCZUCOjafPOIprX4C z61oixHaivjlvHotiILNIy+vy0gOli9gtfQp34GKiGdrYAKJoHHBPxcXMEb8W0pbJu 3OREjX0cSNaVQ== MIME-Version: 1.0 Date: Tue, 31 Aug 2021 11:51:49 -0400 From: Steve Dondley To: zsh-users@zsh.org Subject: Re: Best practices for managing aliases in ohmyzsh? In-Reply-To: References: <41fa241f119fdb9b8598293aad345823@dondley.com> <776abe09c579095258b2eef28a7ad5ca@dondley.com> User-Agent: Dondley Message-ID: <1ee1545904fdc1b5f473460cddfe5000@dondley.com> X-Sender: s@dondley.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Seq: 27016 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On 2021-08-31 04:26 AM, Roman Perepelitsa wrote: > On Tue, Aug 31, 2021 at 1:23 AM Steve Dondley 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 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. OK, thanks Roman. This all sounds like good advice has got me rethinking things. But I'm a little confused on a point you made. What do you consider the difference to be between a script and a function? My functions are typically called with aliases that I've set up. Example: # usage: taskwarrior_cmd # description: runs a task warrior command cmd=${1} shift id=${1} #echo $id; shift echo $cmd; #echo $@ echo task $id ${cmd}$@ task $id ${=cmd}$@ #echo $cmd if [[ "$cmd" =~ ^done ]]; then task +st and \(+imm or +OVERDUE\) next fi Do you consider this to be a function or a script? I have this in a file in my ~/.ohmyzsh functions directory. I don't call this function directly, it is only called from an alias that looks something like this: alias tdep="taskwarrior_cmd 'modify depends:'"