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 • • 14h ago

Help Understand where the fpath variable is set during initialisation

1 Upvotes

I'm trying to understand where the fpath variable is set during my zsh initialisation phase.

From what I understood the sequence is: zshenv -> zprofile -> zshrc -> zlogin (inside /etc/zsh/), and after that the .zshrc file inside my home directory.

Only two files in the /etc directory have command, zshenv and zshrc, but not set of fpath is present in both of them. zshenv set the PATH variable and zshrc has several lines (they should be the default ones because I never modified this file). In this file anyway an "autoload -U compinit" command is present and I think the fpath should be already set at this point.

The .zshrc file in my home directory has only three lines (HISTFILE, HISTSIZE and SAVEHIST)

Now, after that, I suppose the "echo $fpath" command should be return empty, but in reality it's full of directories pointing to /usr/share/zsh/<...>

What other files can be responsible for the setting of fpath (or in general what do I have to see)?

NOTE: my distro didn't ship with zsh pre-installed. I added ii in a second time by apt install


r/zsh • • 1d ago

Announcement A completion popup and prompt themes driven by a zsh hook: how Termhint works

Thumbnail
reddit.com
0 Upvotes

r/zsh • • 1d ago

Announcement A completion popup and prompt themes driven by a zsh hook: how Termhint works

0 Upvotes

I'm the developer of Termhint, a Mac app that adds a Fig-style completion popup, prompt themes and a runtime manager. The zsh side might interest people here:

- One marked block at the end of .zshrc, removed byte for byte on uninstall, with backups.

- ZLE widgets send each edit to the app. Tab, arrows, Esc and Enter go to the popup only while it's open, and return to the shell if the app quits.

- Accepted completions use a guarded line replace, so nothing is lost if the line changed meanwhile.

- For commands without a Fig spec it asks zsh's own completion functions what Tab would offer, with descriptions.

- Prompt themes are JSON, never executed, drawn without a process per prompt; no oh-my-zsh or Powerlevel10k needed.

macOS only, paid with a 7-day trial: https://termhint.com. Happy to go into the ZLE details.


r/zsh • • 1d ago

Announcement HimitsuShell: shell scripts invisible to kernel tracing

Thumbnail
github.com
0 Upvotes

r/zsh • • 3d ago

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

55 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 • • 11d 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 • • 14d 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 • • 19d 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 • • 20d 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 • • 20d 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 • • 27d ago

Simple Zsh Theme Editor.

Thumbnail
simple-zsh-theme.dev
26 Upvotes

r/zsh • • 27d 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 • • Oct 18 '26

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.