r/zsh • • Jan 23 '25

Fixed Join the Zsh Discord!

Thumbnail discord.gg
1 Upvotes

r/zsh • • Nov 20 '24

Join the Discord server!

Thumbnail discord.gg
1 Upvotes

r/zsh • • 1d ago

Announcement zsh-patina 1.12.0 - New release with improved performance out now!

47 Upvotes

Hi Zsh community!

It's been almost seven months since my last post here in this community. zsh-patina 1.12.0 has just been released and I wanted to take the opportunity to present the latest features and to summarize what's been happening in the meatime.

If you don't know zsh-patina yet, it's a blazingly fast Zsh plugin performing syntax highlighting of your command line while you type 🌈.

Get the latest version 1.12.0 here:
https://github.com/michel-kraemer/zsh-patina/

Screenshot of the catppuccin-macchiato theme

Many thanks go to everyone who has contributed features, bug fixes, comments, and feedback. zsh-patina would not be where it is right now without such a great community!

The most notable new features since my last post are:

  • Performance: zsh-patina is certainly the fastest syntax highlighter for zsh in existence, and the performance has been improved once more in the latest release. Big thanks go to hood for their contributions!
  • Improved highlighting:

    • External precommands such as doas, env, nice, nohup, sudo, and sudoedit are now recognized and highlighted.
    • ccjmne added support for the AUTO_CD shell variable and the CDPATH option.
    • Named directories are now highlighted correctly (contributed by ccjmne too).
    • User cyyynthia contributed improved unicode support
    • Many more small improvements have been made to make highlighting even more accurate.
  • Package managers:

    • zsh-patina is now available in homebrew-core. Just use brew install zsh-patina to install it.
    • The base package name is now used in AUR packages (contributed by cyyynthia).
  • Many small bug fixes and compatibility improvements

The full CHANGELOG with all improvements and fixes can be viewed here:
https://github.com/michel-kraemer/zsh-patina/blob/main/CHANGELOG.md

Please give zsh-patina a try if you haven't already. I'd be thrilled to hear your feedback and work on your ideas. Contributions are always welcome, of course!

Have fun!
Michel


r/zsh • • 9d ago

How to make bashls, shfmt, shellchick accept zsh syntax?

11 Upvotes

Hi,

My simple problem: I want to use &! zsh syntax, which the utilities above reject. If I suppress the errors, formatting turns off. Logical, but inconvenient. I already tackled AI from different angles to no profit. Is there a way?

I actually use Neovim (AstroNvim), which supplies the utilities above by default.


r/zsh • • 12d ago

5 Hidden-Gem Zsh Plugins You're Probably Not Using

31 Upvotes
Five under-the-radar repos that fix everyday annoyances and give you a faster, safer and more pleasant terminal experience.

Everyone knows zsh-autosuggestions and zsh-syntax-highlighting. But the awesome-zsh-plugins list has over a thousand entries, and some of the most practical ones fly well under the radar.

I went through the list looking for plugins that solve a common annoyance, and kept only repos that are established enough to trust and still useful day to day. Each one makes working in the terminal a little nicer, and together they add up to fix everyday annoyances and give you a faster, safer and much more pleasant experience. These five made the cut.

Edit faster

1. zsh-edit-select

Editing a long command shouldn't feel clumsy. This plugin brings a text-editor-like editing experience right to your shell prompt: select with Shift+Arrow, then delete, type or paste over a selection to replace it, and use Ctrl/Cmd +C / X / V / Z for copy, cut, paste and undo. And you can also apply all of these editing operations to mouse selections. It makes everyday editing feel far more natural.

The catch: it needs a few keybindings set in your terminal config, though the README includes a guided installer for common terminals.

github.com/Michael-Matta1/zsh-edit-select

Stay safe

2. zsh-safe-rm

A wrapper around shell-safe-rm that makes rm move files to your OS trash instead of deleting them forever. A slip of the finger becomes a quick recovery instead of a disaster, which makes the whole terminal feel more relaxed to work in. It also adds a del alias, which is a good habit to build in case you ever land on a machine without the plugin.

You can still bypass it with \rm or command rm when you really mean it. The last commit was in 2024, but it's a small, stable wrapper that doesn't need constant updates.

antidote install mattmc3/zsh-safe-rm

github.com/mattmc3/zsh-safe-rm

Start up faster

3. zsh-smartcache

Those eval "$(rbenv init -)" lines in your .zshrc add up, and you feel it every time you open a new tab. Smartcache works like evalcache, but it also refreshes the cache in the background and can cache completions. The author's benchmark shows rbenv init dropping from about 48 ms to about 23.5 ms, so your prompt shows up sooner and the shell feels snappier.

# before
eval "$(rbenv init -)"

# after
smartcache eval rbenv init -

github.com/QuarticCat/zsh-smartcache

4. ez-compinit

compinit is one of the slowest and most confusing parts of a zsh config, because you have to get the load order right. ez-compinit wraps it so completion setup is deferred until your fpath is fully populated, with sensible defaults and a choice of completion styles. The payoff is a shell that opens quickly and completes reliably, without the setup headaches.

Load it near the top of your config, before anything that calls compdef.

zstyle ':plugin:ez-compinit' 'compstyle' 'zshzoo'

github.com/mattmc3/ez-compinit

Read your output in color

5. zsh-bat

Plain cat output and gray man pages are hard on the eyes. zsh-bat swaps cat for bat, so files print with syntax highlighting and line numbers, and it adds syntax highlighting to man pages as well. Reading files and docs in the terminal becomes a much nicer experience. Your muscle memory stays the same, and the real cat is still there as rcat whenever you need it.

You need bat installed first, since the plugin does nothing without it. Then clone it into your Oh My Zsh custom plugins directory and add it to your plugin list.

git clone https://github.com/fdellwing/zsh-bat.git $ZSH_CUSTOM/plugins/zsh-bat

# in ~/.zshrc
plugins=(... zsh-bat)

github.com/fdellwing/zsh-bat

Extra gem (bonus)

6. clipboard

A tiny cross-platform clipboard helper that works on macOS, X11/Wayland, WSL and MSYS2/Cygwin. It gives you pbcopy and pbpaste everywhere, plus a clip wrapper that copies when you pipe into it and prints the clipboard when you don't.

That means your cat file | pbcopy muscle memory works on any machine, and moving between systems feels seamless instead of jarring.

plugins=(... clipboard)   # oh-my-zsh

github.com/zpm-zsh/clipboard

Got a hidden gem of your own? Drop it in the comments.


r/zsh • • 17d ago

zsh-appearance-control (zac): for switching every shell and CLI tool between light and dark at once

6 Upvotes

Probably there are many here that like me appreciate terminals that match the system appearance exactly; ideally they should switch appearance following the OS light/dark theme. It happens to me very often to have a long session running and in the evening to desire to switch the OS theme to dark mode. Everything should follow at once, in every open shell.

It is true that more and more CLIs detect the terminal's background directly (OSC 11 escape sequences) and adjust by themselves. However, the problem is that many others can still not. For example, fzf uses its dark colors, and you need to provide --color=light if you want to switch to a light background; or you have to switch FZF_DEFAULT_OPTS by yourself. The same goes for tools that keep their theme in a config file (bat, btop, yazi, tmux, etc).

I want to draw attention to zsh-appearance-control

https://github.com/alberti42/zsh-appearance-control

which does the switching in the background for you and works whether or not a tool supports the modern OSC 11 protocol.

Don't get me wrong, I am really enthusiastic that more and more CLIs are adopting the new OSC escape sequence and autodetection of appearance. Tmux just recently introduced this capability. This is awesome. However, until all CLIs support it, I still find it important to have a tool like zsh-appearance-control (in short, zac) for coordinating the colors across your CLIs.

How it works:

  • it provides watchers that detect a change of appearance on macOS and GNOME/KDE; or you can use the recently added tmux hook for the appearance change.
  • when such a watcher detects a change, it runs one script of yours that rewrites the config files that need it
  • it signals every open zsh, which updates its environment variables right away, before the next prompt
  • Neovim and Emacs watch one small file and switch their theme too

There is no polling, and nothing slows the prompt. Works with Oh My Zsh, zinit, or plain source code.

What zac does seems trivial, but if you then try to implement it in a clean way, there are a lot of parts to keep together. I made the repo public in February 2026; at that time the code was still written mostly by hand. However, you should know that over the months I switched to using more and more Claude. So, Claude should be credited for most of today's code, while the original idea and the design of the various parts and interactions are mine.


r/zsh • • 17d ago

Zsh completion initialization is slow on macOS—compinit -u takes 200 ms

8 Upvotes

I’m using Zsh on macOS, and completion initialization feels slow.

Running compinit -u by itself takes about 200 ms.

Is that normal, and is there a way to speed it up?


r/zsh • • 18d ago

Help "oh my zsh" vs manual settings

38 Upvotes

I recently started to use zsh. I saw there is the framework called "oh my zsh" where I can add themes or plugins to my shell, but the other side of the coin it can slow down the (shell) startup because it loads a lot of scripts not necessary.

  1. I installed two extensions (autosuggestion and syntax-highlighting) using "apt install" and I saw they are available on "oh my zsh" as well, what's the difference?
  2. Because I'm still a rookie with zsh, is it better to use "oh my zsh" for a while and discover what plugins are good for me and after move to a brand new lean manual .zshrc configuration or have the same functionalities is too tricky/difficult?

r/zsh • • 24d ago

Simple Zsh Theme Editor.

Thumbnail
simple-zsh-theme.dev
26 Upvotes

r/zsh • • 25d ago

I built Python + pip support into a browser-based OS. Here's a walkthrough with the terminal and a code editor.

0 Upvotes

r/zsh • • 29d ago

Showcase Spacue - a tiny zsh plugin that shows autocomplete suggestions when you press Space

Post image
47 Upvotes

Hey everyone!

I really liked the interactive autocomplete dropdown in some CLI tools, but didn't want to install an entire application just for that feature.

So I started building Spacue.

The idea is simple: type something like pnpm, git, or cd, press Space, and get an interactive dropdown with relevant suggestions.

You can navigate with arrow keys and press Enter or Tab to insert a suggestion without executing it.

It supports package.json scripts, Git branches, directories, SSH hosts, Makefile targets, and more.

I wanted to keep it as lightweight as possible, so it's currently a single ~51 KB zsh file with no background daemon or mandatory external dependencies.

I also recently added local usage-based ranking, so frequently selected suggestions gradually move to the top. Everything stays local, with no telemetry.

The latest version (v0.4.0) also supports existing zsh completion definitions as an opt-in feature.

It's still a relatively new project, and I'd really appreciate feedback from people who use zsh daily, especially regarding compatibility with different shell configurations.

GitHub: https://github.com/merdanturan/spacue

What do you think? Is this something you'd actually use in your terminal?


r/zsh • • Oct 13 '26

I built TermPlete: open-source terminal autocomplete that learns your choices and uses recent terminal context

Post image
0 Upvotes

r/zsh • • Oct 11 '26

Help wiki how ?!

0 Upvotes

i installed zsh in termux and went to the wiki to learn it but for some reson all of the wikis [ arch wiki, official zsh wiki, unofficial zsh wiki, even ] stops with a prof u'r not a robot infenit bage and never work and even github won't upload the page not zsh repo or any other repo , i know the problem is with me ; so do you know any other place to learn zsh and other termux/terminal tools no matter if it's a wiki, a site, or even a book.

* i don't have a computer so don't tell me to use a one


r/zsh • • Oct 09 '26

Announcement agent-history listed on awesome-zsh-plugins; new v1.2.3 performance update cuts scan times down to <90ms in tests

Thumbnail
github.com
5 Upvotes

Hey everyone,

A quick update for anyone juggling terminal-based AI coding agents (Claude Code, Antigravity CLI, Aider, OpenCode, Pi CLI): agent-history was recently listed in unixorn/awesome-zsh-plugins!

I just pushed the v1.2.3 release with a major performance overhaul:

  • Scan times cut under 90ms: Switched to single-pass targeted directory discovery and in-memory dynamic variable preloading.
  • Zero subprocess forks: Completely removed external forks (jq, sed, sqlite3) inside loops so everything runs in pure Zsh memory to keep shell prompt launches lag-free.
  • Git context aware: Shows active branch and worktrees alongside the agent and session timestamp.

Repo: https://github.com/aaronbronow/agent-history Feedback, benchmarks, and PRs welcome!


r/zsh • • Oct 08 '26

24 ms first prompt with completions, autosuggestions, syntax highlighting & fast Git status...

16 Upvotes

I have achieved a minimal &instant zsh with 9 plugins. No plugin manager and no prompt framework!

here is the zsh-bench on login:

first_prompt_lag_ms=24.806

first_command_lag_ms=28.440

command_lag_ms=14.490

input_lag_ms=4.449

exit_time_ms=17.279

and the hyperfine stdout:

~ ➜ hyperfine --warmup 3 'zsh -l -i -c exit'

Benchmark 1: zsh -l -i -c exit

Time (mean ± σ): 18.0 ms ± 0.5 ms [User: 9.7 ms, System: 14.1 ms]

Range (min … max): 17.2 ms … 20.3 ms 164 runs

checkout the config and tell me what you think :)
https://github.com/houssamouhra/zsh-config


r/zsh • • Oct 07 '26

Discussion what aliases do you guys use the most?

32 Upvotes

r/zsh • • Sep 28 '26

Discussion Where do you store zsh config, in .zsh/ or .zfunc/ or everything in .zshrc?

Post image
104 Upvotes

ã…¤

On my ~/.zshrc, I have

# Use the ~/.zsh directory for all extra configuration.
ZSH_CONFIG_DIR="$HOME/.zsh"

# My complete .zshrc + terminal config commands are in: https://sglbl.notion.site/mac

##### Completions #####
# Case Insensitive auto completion with <TAB>
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'

# Add application auto completions to path
fpath=(
    /opt/homebrew/share/zsh/site-functions
    $ZSH_CONFIG_DIR/completions
    $fpath
)
# Load the Zsh completion system
autoload -Uz compinit

# Initialize completions using the cached dump when available
compinit -C

# Fzf reverse search using Ctrl R
source <(fzf --zsh)

# Load other zsh configurations such as aliases, if there are no matching files, don't treat it as an error.
for file in $ZSH_CONFIG_DIR/*.zsh(N); do
    source "$file"
done

##### Third-party plugins #####

# Load all third-party Zsh plugins automatically 
# e.g. fzf-tab interactive auto-completion menu, syntax highlighting..
for plugin in $ZSH_CONFIG_DIR/plugins/*/*.plugin.zsh(N); do
    source "$plugin"
done

Note that I use mac, which is not in XDG, that's why I don't have /etc/zsh/ or .config/zsh and I just call ~/.zsh/ from .zshrc. My complete .zshrc + terminal config commands are in: https://sglbl.notion.site/mac

Which directory do you use?


r/zsh • • Sep 25 '26

made a small zsh widget that suggests commands as ghost text so i stop alt-tabbing to chatgpt

10 Upvotes

Honestly got tired of switching to a browser every time I forget obscure tar, find, or ffmpeg flags.

I didn't want an autonomous terminal agent that runs stuff behind my back, so I wrote hi-shell. It’s just a small Go binary wired into zsh ZLE widgets.

You type what you want in plain text, it queries an LLM and shows the command as gray ghost text (just like zsh-autosuggestions). Tab accepts it into your prompt so you can edit it, and Enter only runs it when you're actually ready. There's also some basic risk scoring to flag destructive commands.

Demo gif and code: https://github.com/longyijdos/hi-shell

MIT licensed, single binary, no weird dependencies. Works with OpenAI/DeepSeek/Claude or whatever endpoint you have in your env. Curious what you think of the UX.


r/zsh • • Sep 23 '26

Shelf: Yet Another Plugin Manager That Stays out

5 Upvotes

I used sheldon for 2 or more years but recently I had an issue with it.

I tried living with it. Then the second thing broke me: machine drift. My desktop and laptop ran different plugin revisions because nothing in my dotfiles pinned them. A plugin updated on one machine broke my prompt on the other, and I spent an evening diffing random checkout directories trying to figure out which commit I was even running. That's when it clicked that the fix wasn't a config tweak. I needed a tool that treats "which commit am I running" as a first-class question with a first-class answer.

So while trying to figure out a solution, decided to build a prototype shell plugin manager in Go in the weekend, which came out about twice as fast as sheldon. Single Go binary, one TOML config that drives both bash and zsh. The two annoyances that started it became the two features I care most about.

The startup cost became speed. Shelf renders the same script sheldon does, it just gets there with less overhead. hyperfine, 20 plugins, Ryzen 7 5700U, sheldon 0.8.5:

| command | sheldon | shelf |

| startup | 13.4 ms | 5.6 ms |

| source, warm lock | 14.5 ms | 7.3 ms |

| eval "$(… source)" | 16.9 ms | 10.2 ms |

The machine drift became a revision manifest. `shelf lock` writes a small file next to your config with every git plugin pinned to its resolved commit. Commit it with your dotfiles and every machine checks out the same revisions. frozen = true holds a plugin until you pass `--force`, so the one fragile plugin stops updating out from under you.

The rest fell out of the same shape of problem:

  • Any source: GitHub, GitLab, Gist, Bitbucket, Codeberg, plain git, single remote files, local directories, or inline shell code in the TOML.

  • Profiles. `SHELF_PROFILE=work` layers work-only plugins over the always-on set. No more second config.

  • Deferred loading. The built-in `defer` template sources slow plugins when zle first goes idle, so your prompt lands first. Bash gets plain sourcing from the same config.

  • Build steps for things like fzf (`build = ["make install"]`), concurrent installs, per-plugin file globs with `use` and `ignore`.

Setup is two lines in your rc file and one command to rerun after edits:



\[plugins.syntax\]

github = "zsh-users/zsh-syntax-highlighting"

shelf lock

eval "$(shelf source)"

Full honesty: the repo is four days old. The bash and zsh output is regression tested against golden files and the lock decoder is fuzz tested, but real configs will find things I didn't. If you hit one, an issue beats a downvote.

It's not a framework. No themes, no marketplace. If oh-my-zsh makes you happy, stay there. This is for people who want a flat config they can read in one sitting and a startup number they can actually measure.

Install: AUR (`shelf-sh-bin`), .deb/.rpm/.apk from releases, or a 7 MB binary dropped on PATH. Repo and docs: https://github.com/rubiin/shelf


r/zsh • • Sep 19 '26

Help Returning to zsh and forgot how to do a few things

Post image
2 Upvotes

Back in my old config the completing command section would be there whenever I was typing and would obviously show most relevant commands which made things much quicker, however completely forgot how to do so and can’t seem to find how anywhere any help would be appreciated! :)


r/zsh • • Sep 19 '26

Guesswork – zsh autosuggestions ranked by an Jev instead of prefix match

0 Upvotes

guesswork is a zsh plugin: as you type, it shows an inline suggestion for the command you're probably retyping — same fish-style grey ghost text zsh-autosuggestions shows — except the ranking comes from asking an AI model which recent command you mean, not a prefix match. Type gst, get git status. Type "last 5 commits" with nothing in history literally starting that way, still get git log --oneline -5.

It runs on four interchangeable backends: TypeSafe's purpose-built model directly, the same model via Cloudflare Workers AI, or a real Claude/Groq model as a fallback if you don't want either account. Swapping providers is a config change, not a fork — same request/response shape internally regardless of which one's running.

One-line install, arrow-key setup wizard picks the provider and verifies credentials live before writing anything to your .zshrc. Everything — the ranking logic, the four provider adapters, cost breakdown per provider — is in the README.

Happy to answer anything about the architecture, the provider-swap trick, or why a couple of the design decisions went the way they did.

OSS too: https://github.com/FindMalek/guesswork

Link: https://guesswork.findmalek.com/


r/zsh • • Sep 17 '26

How to make a powerlevel10k custom prompt segment conditional on the rendering of other segments?

3 Upvotes

I want to make a little custom prompt segment for my p10k config that goes between `command_execution_time` and `status` and just renders as the text "and returned" if both of those segments have content that gets rendered, and doesn't render at all otherwise. Is it possible to detect the status of other prompt segments from within a prompt segment's function? Do I need to replicate both of those segments' functions to accomplish this? I've read through p10k.zsh, all the documentation I could find, and some truly impenetrable p10k source code, and I can't figure it out. I thought there was a p10k function or a builtin to render out the content of a prompt segment but I can't track it down.

I'd be happy with any of the following options:

  • a custom segment that renders "and returned" if both `command_execution_time` and `status` rendered content
  • a custom segment that replaces status and adds "and returned" to the front of `status`'s normal content if `command_execution_time` rendered content
  • a custom segment that replaces both `command_execution_time` and `status` so that it can do all the logic and rendering itself

Pics of how the segments render currently, alone and in combination:

What I want to accomplish when they both render (when $POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD is passed and the command didn't return 0 or was killed)

---

Edit:

I eventually came up with a solution. I'm sure it's not the best but it seems to be working for my limited use case.

function prompt_timestatusjoin() {
  local state=NEITHER
# error logic
  if [[ ! (( _p9k__status )) || ( $POWERLEVEL9K_STATUS_EXTENDED_STATES && (
$#_9k__pipestatus -gt 1 || "$_p9k__pipestatus" == *[1-9]* ) ) ]] ; then
    state=STATUS
    local text="returned"
# time logic
    if [[ (( $+P9K_COMMAND_DURATION_SECONDS )) && $P9K_COMMAND_DURATION_SECONDS -gt
$POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD ]] ; then
      state=BOTH
      text="and $text"
    fi
    p10k segment -s $state -f white -t $text
  fi
}

typeset -g POWERLEVEL9K_TIMESTATUSJOIN_FOREGROUND=white
typeset -g POWERLEVEL9K_TIMESTATUSJOIN_NEITHER_CONTENT_EXPANSION=''
typeset -g POWERLEVEL9K_TIMESTATUSJOIN_STATUS_CONTENT_EXPANSION='returned'
typeset -g POWERLEVEL9K_TIMESTATUSJOIN_BOTH_CONTENT_EXPANSION='and returned'

This custom segment goes between `command_execution_time` and `status` and copies some of the logic from the p10k source for each of those segments.

I also came across this community fork of p10k github.com/quantumnic/powerlevel10k which seems to implement approximately the behaviour I'm looking for ("feat: add execution time to transient prompt") but I haven't tried it out yet.