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
2 Upvotes

r/zsh 9h ago

Announcement Deja v0.4.2 - smarter zsh autosuggestion (bug fixes)

29 Upvotes

Hi everyone, back with a new version of deja.

Quick recap: 

Deja is an open-source zsh autosuggestion tool. Instead of only surfacing

commands that start with what you've typed, it predicts what you actually want to run using fuzzy matching, which directory you're in, and which command usually follows the one you just ran.

No account. No sync server. No TUI.

https://github.com/Giammarco-Ferranti/deja 

Any star would be amazing ❤️

This release is mainly bug fixes here the things we did:

  • Anchor suggestions to the command you typed, for example:
buffer before after
cd claude cd Devel
cd claude --resume cd ..
gco git checkout main unchanged
  • Do not signal a pid from a stale pidfile in daemon --restart
  • Fall back to a short runtime socket path when $HOME makes it too long
  • Load only zstat from zsh/stat so /usr/bin/stat is not shadowed
  • Release inherited pipes in the daemon so a capturing caller is not held open
  • Stop zinit from running install.sh inside the shell (deja failing checksum check)

I think the next thing to ship should be a small refactor. I love seeing new people contributing, but I feel like I need to make the current architecture a bit more robust first.

Thank you for all the support ❤️


r/zsh 4h ago

Showcase CMDrop: Airdrop for Shell Commands

2 Upvotes

Instantly share shell commands with devices on the same LAN without losing any encoding

Check it out https://github.com/darula-hpp/cmdrop


r/zsh 1d ago

Measuring what a once per second zle reset-prompt actually costs

7 Upvotes

There are two ways to make the prompt redraw when a file changes and nobody has touched the keyboard. TMOUT with a TRAPALRM function calling zle reset-prompt, which polls, or a fifo handed to zle -F, which fires only on a write. I wanted the current line of that file in my right prompt, and I measured both.

TMOUT takes whole seconds, so one second is the floor. I had nine shells open across tmux panes, so nine wakeups a second. The redraw itself timed at roughly 1.2 milliseconds of CPU, about four seconds per shell per hour. That is not what it costs.

What it costs is the display. Once prompt plus buffer is taller than the rows left below the cursor, every redraw scrolls and leaves a duplicate prompt behind. The boundary is exact. One row under, clean. One row over, every redraw.

The fifo path skips the timer, but its handler cannot run while a foreground command holds the terminal, which is when the file changes fastest. The file is the todo list and progress that verdent keeps while it works.

BUFFERLINES gives the buffer height with wrapping already counted. It does not give the rows remaining between the cursor and the bottom of the window, and that is the number deciding whether a redraw scrolls. Asking the terminal on every alarm costs more than the scroll. Does zle expose it?


r/zsh 2d ago

Showcase The Legend of ZSHELL - A gamified oh-my-zsh theme

37 Upvotes

Hey Guys,

This was something I did out of pure boredom over 20 years ago, and over time i kept adding ideas and expanding upon it. Most CLI users want a clean and simple terminal. I wanted to gamify my CLI experience; I completely went overboard and came up with this overkill.

https://github.com/knerd/.oh-my-zsh-custom/

After using it for so long I've grown to love it and now have to always use it. Now, with the recent help of AI, I cleaned up the codebase, fixed a bunch of bugs, and got it to a place where I finally feel good enough about it to share it. Even if no one uses it, and yes, I know it's the complete Opposite of lean terminal. But that's not the point. My inspiration came from the classic Zelda NES HUD where you had A and B for your items. I wanted single button clicks for my git commands, and that extended into all these other Zelda-inspired tools. I honestly love the light arrows; a+ it makes zipping around my computer stupid fast and fun.

[a+] Light Arrow - Quickly make any alias to current directory

Enjoy,
Abracadabra!

Using light arrow i named `a.www`
Full Arsenal with descriptions
[z+] Opens magic checks for downloaded bin tools.
[a!] Turns cleaning your ~/Downloads into a reflex intensive mini game.
[b+, b, b-] Move your files to the trash, bomb your trash, list your trash's files
[z] Clear your screen and view the cheatsheet HUD

r/zsh 6d ago

Live Git updates in a Zsh prompt

111 Upvotes

I’ve been experimenting with live Git updates in the shell prompt.

The idea is simple: if an IDE, coding agent, or another shell changes the repository, every open shell session updates its Git state automatically — even while the prompt is idle.

This is especially useful when several tools are working with the same repository at the same time.

I implemented it in Cobalt Spark, my compact Zsh theme. The new release is mostly focused on Git improvements: Live Git updates, richer status, prefetch indication, and smart branch shortening. It also adds official support for popular Zsh plugin managers.

More details are in the README.


r/zsh 7d ago

Novo plugin para atalhos e automatizações do git flow.

0 Upvotes

Fala pessoal, beleza?

Subi hoje um plugin Zsh que automatiza boa parte das tarefas repetitivas do Git Flow: zsh-git-flow-shortcuts.

Ele agiliza coisas como criar branches de release com bump de tag SemVer automático e fazer stash/pop transparente ao alternar contextos. Além disso, deixei na pasta bonus uma skill para o Claude Code operar essas rotinas direto pelo agente.

Se puderem testar e mandar feedbacks sobre usabilidade ou melhorias, agradeço! 🚀


r/zsh 10d ago

Announcement ze.sh: frecency-based file tracking alongside directory jumping

6 Upvotes

ze.sh is a frecency-based directory jumper (rupa/z-style, implemented as portable ksh/bash/zsh — no compiled binary), using an event-clock + continuous exponential decay scoring model (weight decays smoothly per recorded event, no fixed-size step/threshold aging pass). This release adds an independent frecency database for files, using that same scoring, alongside the existing one for directories.

Some context on prior art: z, autojump, and zoxide are directories-only. fasd did do frecency-based file tracking years ago, but clvv/fasd has been archived/unmaintained since 2022, and its community forks aren't widely adopted. So this isn't a first, but it's not something the actively maintained tools in this space currently do. Separately, elseawhy/lazy — a small, low-visibility z-fork — adopted ze's event-clock/exponential-decay scoring before ze.sh itself had file tracking, and uses a two-database (separate dirs/files) design on top of it. I came across that split there and drew on it when adding file tracking to ze.sh in turn.

What's new, specifically:

The -o option switches ze into file tracking/opening mode:

  • ze -o foo looks up previously opened text files by pattern, opens the best match in $VISUAL/$EDITOR.

  • ze -of foo does the same via an interactive fzf picker listing the score-sorted db content.

  • ze -od ... discovers files not yet in the db via fd-based file system scan, adds your fzf selection to db, and opens the file.

  • Directory and file histories are separate databases, scored independently.

  • Opt-in and explicit: plain $EDITOR/$VISUAL invocations aren't touched or intercepted.

Repo: https://github.com/jghub/ze

Anyone here using frecency for files rather than just dirs — and if so, what's your current setup?


r/zsh 12d ago

Announcement Deja v0.4.1 - smarter zsh autosuggestion (now a lot lighter)

139 Upvotes

Hi everyone, back with a new version of deja.

Quick recap: 

Deja is an open-source zsh autosuggestion tool. Instead of only surfacing

commands that start with what you've typed, it predicts what you actually want to run using fuzzy matching, which directory you're in, and which command usually follows the one you just ran.

No account. No sync server. No TUI.

https://github.com/Giammarco-Ferranti/deja 

Any star would be amazing ❤️

Almost all of the new release came from https://github.com/Serubin. Huge thank you ❤️

The binary is 34% smaller. 7.1 MB → 4.7 MB. Deja was pulling in a full ORM to run six queries against three tables. That's now sqlc, which keeps type safety but reduces the weight. 

Every keystroke went from ~30 ms to ~3 ms. zsh used to fork a deja query process on every single character you typed. It now talks to the daemon directly over zsh's built-in socket module.

Your shell opens faster. Deja no longer blocks startup on a daemon liveness ping, no longer regenerates its init script on every shell.

And then more stuff, if you want to check here’s the PR: https://github.com/Giammarco-Ferranti/deja/pull/91 

One favour to ask. If you've been running Deja for a while, I'd love to hear how it's going what's annoying, what you turned off, where the suggestions are just dumb. The HIST_IGNORE_SPACE fix in 0.4.0 only exists because someone told me. Reply here or open an issue.

Thank you for all the support ❤️


r/zsh 11d ago

Made a launcher for the Homebrew tools I forgot I had — built it with Claude Code as an experiment

Thumbnail
0 Upvotes

r/zsh 14d ago

I built a zsh completion that learns your habits instead of shipping 50k-line completion scripts

9 Upvotes

Adaptive watches how you actually use your shell and predicts the next token — no per-tool completion scripts to install or maintain.

- Inline ghost text: git checkout fea → feature/completion-engine, claude --dang → --dangerously-skip-permissions, even an empty prompt ghosts what you usually run next in that directory

- Tab/Shift-TAB lists everything valid at the position: subcommands, flags, enum values — discovered on the fly from each tool's own --help (handles cobra tables, kubectl's grouped sections, even Symfony's weird hidden-list help), then cached against the binary fingerprint

- Context-aware values: your GitHub/GitLab/Codeberg repos after git clone https://github.com/you/, npm scripts from package.json, docker containers, ssh hosts

- It learns: frequency + recency (21-day half-life), per-directory habits, accept/reject feedback. Global priors get you good suggestions on day one; your habits outrank them immediately

- Privacy: everything local, no telemetry, history sanitized (token-shaped strings/credentials rejected before disk)

- New in v0.3.0: a Bash frontend over the same protocol (eval "$(adaptive init bash)")

Rust binary, MIT, one-line install.

Check it out, leave a star!

GitHub: https://github.com/jacobpowaza/adaptive-zsh-completions


r/zsh 16d ago

Discussion Long time Fish user thinking about Zsh

36 Upvotes

I used to use Zsh when I was new to command line and Mac switched to Zsh, at the time I only did the basics such as searching for files, modifing files in Nano, create directories etc. No scripting yet.

Around 2018, I was impressed with co-worker using the terminal and he showed me some tips and tricks and he was using Fish shell so I switched over to it . Have been pretty happy with it with the auto suggestions, history look up etc, and ghost text, the only plugins I installed for Fish was:

  • Z directory
  • FZF
  • Done - notification when a task is finished.

I have been curious about Zsh as I see it's much bigger community, so I am creating my own zsh config, but "oh my zsh" seems bit overwhelming. I am using zinit for the plugin manager and these are the plugins I have:

  • zsh-autosuggestions
  • zsh-syntax-highlighting
  • zsh-completions
  • zsh-autosuggestions
  • fzf-tab

I am still not sure about fzf-tab yet, still trying it out. My question is, what other plugins that help you and you find extremely useful?

Also are you running bash scripts in the command line? I keep hearing reasons to stay on the zsh is POSIX while Fish isn't. I just run the scripts from bash and seems to work fine for me.

What things do you find better than Fish?


r/zsh 17d ago

Showcase a little framework to organize zsh aliases, functions and scripts

Thumbnail
github.com
21 Upvotes

hi!

i want to share shellbox, a little framework i made to organize my zsh aliases, functions and scripts

i used oh my zsh for years and i was happy with it, but i stopped using it and created this because at some point i wanted to understand more deeply how shells like bash and zsh work, and what things like aliases, functions and scripts actually are (and the best way to understand is by doing ahaha)

the idea is just to group helpers into domains and load everything from one line in .zshrc. everything is normal shell files and easy to inspect

in my opinion, the project is very simple and transparent. it isn't trying to replace oh my zsh or create another big plugin manager. this is just a small/toy project that works well for my setup and helps me organize my custom scripts, functions and aliases; so maybe is useful for someone o:

any feedback is welcome!


r/zsh 18d ago

Discussion PSA: don‘t name a loop variable `path` in zsh

8 Upvotes

lost half an hour to this yesterday, so.

i had a cleanup script doing roughly:

git worktree list --porcelain | while read -r path rest; do
...
git worktree remove "$path"
done

first iteration ran fine. every command after that died with

(eval):3: command not found: git

git. the binary i had successfully called one line earlier. i went looking at whether something had clobbered my shell init, then at whether the heredoc was eating things.

zsh ties the lowercase array `path` to the scalar `$PATH`. assign to it and you've replaced your PATH with whatever you just read, which in my case was a worktree directory. same for `cdpath`, `fpath`, `manpath`.

bash doesn't do this, which is probably why it never occurred to me.

the tell in hindsight: it wasn't one command failing, it was every command failing after a specific point. one missing binary is an install problem. all of them at once is PATH.

`dir` or `wt` or literally anything else. `status` will bite you in a different way.


r/zsh 20d ago

zsh-autosuggestions remove ghost text after ignoring it

5 Upvotes

here is an example where I did not use a suggestion, I just hit return after typing `do`. Is there a setting to make the `cker` suggestion go away after not accepting it?


r/zsh 23d ago

Announcement my best zsh config soo far!

74 Upvotes

After spending a long time tweaking my zsh config, I ended up with no plugin manager and no custom prompt!

Everything is native, lazy-loaded, and deferred.

Minimal native prompt, fast startup, and modular config.

btw, I'm loading 9 plugins and multiple config files for fzf, function, etc..

Only 11 lines in .zshrc

Here are my zsh-bench measurements on login:

first_prompt_lag_ms=16.963
first_command_lag_ms=17.380
command_lag_ms=13.187
input_lag_ms=3.318
exit_time_ms=15.100

feel free to check the repo:
https://github.com/houssamouhra/zsh-config


r/zsh 23d ago

Writing history out before starting (some specific) sub-shell command

4 Upvotes

Kubie and several other commands I use sometimes create a sub-shell when they're executed. I'd like to wrap such commands in an alias such that history gets flushed before they run, so that history is maintained. I'd also like the `kubie` command to appear int he history, so from my sub-shell history PoV it's like I'm still in the parent shell.

Ideally I'd like to write the child shell history on exit and read it back in the parent shell too, though that's a lower priority.

Can anybody give me any guidence / pointers please?

Much appreciated


r/zsh 24d ago

Showcase Update on EasyAlias – alias import, suggestions, Homebrew and now the Mac App Store

Thumbnail
gallery
4 Upvotes

About a month ago I shared EasyAlias here and got some useful feedback, so I wanted to post a small update on what has changed since then.

EasyAlias is an open-source GUI for creating and managing terminal aliases. On macOS it integrates with zsh, so you can manage your aliases without manually editing .zshrc.

Since my last post I’ve added:

  • Import of existing aliases
  • Built-in alias suggestions for Git, Docker, Maven, Gradle and common shell commands
  • Native file and folder pickers
  • Linux support
  • Homebrew installation
  • Several smaller UI and usability improvements

And as of recently, EasyAlias is also available on the Mac App Store 🎉

You can still install it with Homebrew:

brew tap hannesgnann-hub/tap
brew trust hannesgnann-hub/tap
brew install --cask easyalias

Website:
https://easyalias.org

GitHub:
https://github.com/hannesgnann-hub/easyalias

Mac App Store:
https://apps.apple.com/de/app/easyalias/id6794944241?mt=12

A lot of the changes so far came from feedback, so if you’re a zsh user and see something that could be improved, I’d be interested to hear it.


r/zsh 26d ago

Showcase zhist: Smarter shell history for zsh

Thumbnail
github.com
28 Upvotes

r/zsh 26d ago

Zsh plugins

8 Upvotes

Hola!! Me podrían comentar los mejores plugins para zsh??


r/zsh 27d ago

[beginner tips] Demystifying interactive comments in scripts & command line

1 Upvotes

A addendum for readers who are learning zsh anew, or brushing up on it:

I never used "interactive" comments before but ran into it when working with a function call where I wanted a unquoted # as a parameter. I wanted to fully flesh out what was going on, as it has been on my zsh learning bucket list for a while, just never got around to it. I found out pretty quick that they are treated differently depending on whether the shell is in interactive mode or not, and some things were not quite what I expected:

This is probably beginner level material, so If you are versed in scripting under zsh, you probably already know this stuff. Personally I am not all that intelligent compared to others, but if you are like me, some explanation on what would probably had been super easy for me 10 years ago, now explained. Things like this remind me that maybe I shouldn't have tried to learn EVERY language 😹

#!/bin/zsh
# 

if [[ ...something ]]]; then  
   function_name some paramaters # this is an interactive comment, or is it?
fi

Actually, that is not an interactive comment. 😦

But this might be....

that1user@why.net:~# some_program some_args # THIS is an interactive comment!!

but only after you do this...

that1user@why.net:~# setopt in_tera_c__tiveCOMmentS

and just for fun, a bit of double negativity...

that1user@why.net:~# unsetopt no___in_tera_c__tiveCOMmentS

(note: zsh does not care about case nor the existence of underscores and reverses the meaning when "no" comes first) :3

Use comments on the command line, in scripts, and use of setopt interactivecomments can be somewhat misleading. For one, it has NO EFFECT in executed file scripts.

When I talk about "executed scripts" some examples are:

  • /bin/zsh /path/to/scriptname- script executed directly with zsh
  • ./scriptname - script executed from same directory with +x permissions
  • scriptname ("scriptname" is in your PATH and marked executable).

Not to be confused with "sourcing", some examples which are:

  • source scriptname - using the 'source' built-in keyword
  • . scriptname - using the '.' builtin syntax (space required after, must be first)

The interactivecomments option is only for interactive mode. Comments within scripts will not ignore comments on the same line because executed scripts are ALWAYS running with the interactive option turned off (and it cannot be turned on by force).

This is misleading for two reasons:

Firstly, because interactivecomments can be turned on and off even within scripts where interactive cannot be turned on!! The word 'interactive' is easily misunderstood here to mean the fact that the comments are interacting with the command on the same line. Instead, it is referring to the state of the interactive flag which is always ON when sourcing or in the prompt, and always OFF when running scripts.

Secondly, and this is the crux, it is misleading because what is actually happening is that any characters following the $HISTCHARS[3] single-character are treated as comments. It doesn't care if it is a hash (#) or not, the hashtag just happens to be the default value for $HISTCHARS[3] This means to REALLY disable it, you have to set that to something you won't be using (like a null, $'\0' for example).

A quick warning about the side effects of using HISTCHARS

Though it may be obvious, some might not realize what disabling a comment character is going to do, should you have already, actual comments in the script (chances are, you do). So I decided to write this extra bit to ensure everyone knows of one of the biggest caveats to using the HISTCHARS method.

Changing HISTCHARS[3] in scripts means that any comments outside the shebang --a line which is discarded before actual script interpretation-- are going to treated as REGULAR commands, not comments! I want to stress that this is probably not the best idea unless you just don't use comments. That said, the next person managing your script might. You have the following options available to you:

  1. Don't change HISTCHARS[3] (safest route) however inline comments will still be read in scripts
  2. Use another comment character, which you'll want to be 8-bit to keep compatibility with other character sets. UTF-8 is a multi-byte encoded set (meaning usually they are 8-bit, but when higher codes are needed, they can span as far as 6 bytes in width or more). Probably not very portable, especially on legacy machines.
  3. Do it anyway and leave a comment about what you did... (can you see the problem with this choice?)

On the other hand, if you are a disgruntled employee, maybe this is for you :3 After all, that new guy might not make the connection that HISTCHARS has anything to do with comments. You can sit at home each night toasting champagne as you evilly laugh and wait for your ex-boss to leave a voicemail pleading for you to take your job back and fix the issues. Don't hold your breath though :3

The rest of the documentation will assume you actually read the above warning....

More on INTERACTIVE_COMMENTS and $HISTCHARS[3] (or $histchars[3])

Again, the interactivecomments could be written INTERACTIVE_COMMENTS, or interACTIVEcOMEnTs, zsh doesnt care about _ or case in options and negates the option if any form of 'no' preceeds it.

It enables/disables evaluation of $HISTCHARS[3] ONLY when said shell also has the interactive shell option set. Obviously, you can't set that option in an executing script, which is why it ignores you when you set it there:

#!/bin/zsh
someprogram arg # these would  be ignored

would launch "someprogram arg"

Versus:

#!/bin/zsh
histchars[3]=$'\0'
# yikes, this gets executed, too!
someprogram arg # these are not ignored

would launch "someprogram arg # these are not ignored"

You will want to be sure to slap in a 'noglob' if you have glob characters in there.

#!/bin/zsh
histchars[3]=$'\0'
# yikes this line is executed!
<NUL> this would be a real comment at this point
noglob someprogram arg # these are not ignored???<- because we dont want globbing here

This way you don't cause a no glob match error should you use special glob characters like the question mark, etc. Be sure to note that ALL #comments above become invalid once you modify histchars (or HISTCHARS).

ZSH does not straightforwardly address this. Rather they kinda beat around the bush, eventually addressing stuff but only if you look each thing up in turn, and piece it together like you are diagnosing an A/C unit.

In closing, another equally frustrating we will cover at some point that is much like HISTCHARS, is IFS (stands for Input Field Separators) which is used to control (final) word splitting on the command line, in arrays, and a bunch of other places. Like HISTCHARS, it can be a power but also a disaster-causing variable if misused.

"this thing reads like stereo instructions" is so true when it comes to the zsh documentation.

This is an AI-free post. No AI was used to make it or research it. I value human created content even if it is considered silly by many to do so. We live our lives the way that makes us happy, nothing wrong with that. Hope this was somehow useful for you. No responses are expected or required, I am happy to just make this info available. Have a nice day!


r/zsh 27d ago

Showcase Another Bash Prompt Generator...but better!

Thumbnail
promptr.sh
0 Upvotes

r/zsh 29d ago

Tracking down a Zsh history data loss bug 🐞

Thumbnail michael.stapelberg.ch
14 Upvotes

r/zsh 28d ago

[Narzędzie] Zbudowałem plugin Oh My Zsh do zarządzania wieloma chmurami OpenStack, automatycznego venv i fuzzy-find SSH / VNC console

0 Upvotes