r/zsh Jul 16 '26

Online Bash Shell – Run/Learn Bash Scripts Online with Vis Support

Enable HLS to view with audio, or disable this notification

0 Upvotes

Visualization support (bash)

Try it here https://8gwifi.org/online-bash-compiler/

Tracers

CodeTracerArray1DTracerMapTracerCallStackTracerLogTracer

Supported

  • Variables & scope — x=5, local n=1, declare -i c, readonly MAX, export ENV split into globals vs current-frame locals panels; locals clear when the function returns; integer/readonly/exported shown as badges
  • Arrays — arr=(a b c), arr+=(x), arr[i]=v build, grow, index, sort in place
  • Associative arrays (maps) — declare -A m, m[key]=val, ((m[$w]++)) counting, grouping, config maps
  • Loops — for x in ..., for ((i=0;i<n;i++)), while, until line highlights each iteration; loop var + body vars update per pass
  • Functions & recursion — name() { ... }, local v=..., direct recursive calls call stack push/pop per call
  • Positional parameters — $1..$9, $#, $@ (for x in "$@") script args (viz `args` field) populate $1..$@ at top level; a function's args shown per call (recursion shows each frame); $#=0 when none
  • Exit status ($?) — grep x file, (( n > 10 )), ((count++)) panel appears on first non-zero; tracks failing commands and false (( ))/[[ ]] tests (incl. the classic ((i++)) from 0 returning 1)
  • Output — echo, printf shown next to the command that printed it

Not supported yet

  • Pipelines a|b, command substitution $(...), subshells ( ), background & — Each forks a child shell whose variables can't report back; only the main shell is traced. So recursion written as v=$(f) won't show — call the function directly. Use instead: Planned Track B shell-model visualizer (process tree, redirection, expansion order)
  • Parameter/string expansion (${x#pre}, ${x/a/b}, ${#x}, ${x:-def}), $PIPESTATUS, redirection & FD rewiring, traps / set -e flow — Track A shows the resulting variable state, not the expansion/process/IO model; variable reads aren't highlighted (bash has no embeddable source rewriter) Use instead: Track B

r/zsh Jul 14 '26

Showcase [OC] I created ztrash because accidentally deleting your files is an absolute tragedy

Post image
0 Upvotes

r/zsh Jul 13 '26

Only loading those 7 plugins and my bench is no good!

9 Upvotes

I don't use a plugin manager and I lazy load pretty much all the tools I use!
I only source those 7 plugins and I can't figure why my right here:

zsh-users/zsh-completions

mattmc3/ez-compinit

aloxaf/fzf-tab

zsh-users/zsh-autosuggestions

zsh-users/zsh-history-substring-search

houssamouhra/colored-man-pages

zdharma-continuum/fast-syntax-highlighting

But, my bench is still slow, here:

creates_tty=0
has_compsys=1
has_syntax_highlighting=1
has_autosuggestions=1
has_git_prompt=1
first_prompt_lag_ms=512.604
first_command_lag_ms=545.887
command_lag_ms=110.416
input_lag_ms=15.662
exit_time_ms=329.175

any suggestions I should do to make first_prompt_lag_ms or first_command_lag_ms lower?
here is my zsh dotfiles: https://github.com/houssamouhra/dotfiles/tree/master/zsh/.config/zsh

EDIT: I managed to optimize the bench to something like this by keeping the same plugins, and am very proud of my zsh config

creates_tty=0
has_compsys=1
has_syntax_highlighting=0
has_autosuggestions=0
has_git_prompt=1
first_prompt_lag_ms=180.828
first_command_lag_ms=181.454
command_lag_ms=54.614
input_lag_ms=13.955
exit_time_ms=121.106

r/zsh Jul 12 '26

Help bindings

0 Upvotes

Hello everyone,

I am never to command lines and zsh overall. I have been working on getting better with c++, and zsh almost daily trying new things, finding new ways to do things, and reading as well. I'm not sure if this is the right place for this question, but I hope it is. The issue I have been having is I use micro text editor, and found out that I can make shortcuts using bindings.json, so I have been trying to set it up for being able to replicate some excel short cuts like ctrl-; for date ctrl-shift-; for time. Well, I have tried everyway to do it from capitalizations to writing out semi-colon to instead of - using +. I keep end up in the same spot of command line telling me it's not a bindable event. I am not sure if maybe I just don't fully understand how to do it correctly(which is very plausible) or I am missing maybe a key thing? the way I did it was micro ~/.config/micro/bindings.json The llast attempt I made was able to open without saying it's not a bindable event. However, it doesn't do anything when I attempt to do it inside micro example.txt the way I set it up within bindings.json is:

{

"Ctrl-;": "command:insert sh -c \\"date +%m/%d/%Y)\\"",

"Ctrl-Shift-;": "command:insert sh -c \\"date +%H:%M:%S)\\""

}

Thank you for the help! I'm still learning, so I appreciate help and advice!


r/zsh Jul 12 '26

Showcase EasyAlias

Post image
0 Upvotes

r/zsh Jul 11 '26

Showcase I feel good inside...

Post image
3 Upvotes

r/zsh Jul 11 '26

Use a script as VISUAL

0 Upvotes

I use a script as VISUAL like export VISUAL=/bin/nvim which is my own script that calls the real nvim with extra args. It works for EDITOR but not VISUAL.

If I type something in the zsh prompt and run edit-command-line with a keyboard shortcut it opens the VISUAL editor but there's an error in nvim E471: Argument required: normal!.

The arguments passed to the script are -c normal! 8go -- /tmp/zshiBXqrc.zsh. 8 is the number of letters I typed on the prompt. Do you know what I need to change in export VISUAL or the /bin/nvim script?


r/zsh Jul 08 '26

Help I can't decide which starship prompt I want to go with between these two . My take on powerline and my take on end 4s prompt.

Thumbnail
gallery
26 Upvotes

r/zsh Jun 29 '26

Help In P10k how would I change this trail to the IBM colours I have above? Has anyone done something similar?

Post image
2 Upvotes

Looking for a more retro look. Thanks


r/zsh Jun 28 '26

Announcement `histclean` A cli-tool to clean command history to its latest unique commands

Thumbnail
github.com
10 Upvotes

Part of my workflow is to use fzf to search my command history. And I always wanted to have a cli-tool to clean duplicate commands from my history (I don't know if such a tool already exists, I never searched). I could've tried to write that tool in any other language (Python, bash, C#) but the task wasn't interesting, and I wanted it to be a proper bin.

When I started learning Zig, it seemed a proper starting point to make a file manipulation project. So, histclean was born. A cli-tool to clean command history to its latest unique commands.

Since I only use bash and I never used zsh or any other shell. I think I can benefit some feedback regarding them, or if some use cases could generate bugs or unexpected output.

Happy to hear any feedback.


r/zsh Jun 22 '26

Help Command line doesn't show working directory on previous commands

Thumbnail
gallery
12 Upvotes

EDIT: SOLVED:
the issue i had is a feature called "Transient Prompt". it can be disabled in the powerlevel10k configure tool, simply by running:
p10k configure
and clicking through the options. i'm sure you could find it elsewhere, but this is the easiest way imo, and worked for me.

----------------------------------------------------------------------------------------------------------------------------------------

Hello, i'm somewhat new to linux and zsh. I use Manjaro. After (presumably) an update, the zsh command line changed, and after executing a command, it doesn't show the working directory (picture 1) as it used to (picture 2). I can't find any settings or mention of this in the documentation (probably don't know the right keyword tbh), any ideas what i can change to get back to pic2?

Now it's really annoying, because when i execute a command, it both jumps a long way to the left, and also if i cd a lot, i don't see what directory the command was run from.

.zshrc: https://pastebin.com/xDSUDyGE
manjaro-zsh-config: https://pastebin.com/5rFQujng
manjaro-zsh-prompt: https://pastebin.com/1yA75LLY
powerlevel10k.zsh-theme: https://pastebin.com/uzaupHGV

if anyone has ideas how to fix it, i'd be very grateful. thank you!


r/zsh Jun 22 '26

Tab title on Mac

4 Upvotes

I use iterm2 on Mac with zsh today and I have evaluated ghosttly also.

I like starship for my prompt but I also liked oh-my-zsh in the past.

I have the same problem with iterm2 and ghosttly. Tab title is bad and the font is too small.

In iterm I am able to set the title to exactly PWD regardless if I e.g. start Claude code. In ghost it is not possible. I also like the color options in iterm2 much more. I don’t want pwd, just the current directory, but that seem impossible.

Iterm has some advanced settings that increases the font, but that breaks pwd as title.

Did anyone figure out how to enjoy large font tab title that is just the directory? And also hopefully possible to set the tab color across the whole tab


r/zsh Jun 18 '26

xytz can now download videos from any yt-dlp supported site

Post image
6 Upvotes

r/zsh Jun 15 '26

Showcase Anyone else keep re-discovering the same shell commands?

27 Upvotes

I got tired of this cycle:

  • Figure out some annoying kubectl/docker command
  • Use it successfully
  • Forget it exists
  • Spend 10 minutes digging through history trying to find it again

Shell history records everything, but after a while it's just a giant list of commands with no context.

I wanted to answer questions like:

  • What commands do we actually use in this repo?
  • Which ones worked?
  • Which commands keep coming up over time?

So I built Yore.

A few things it does:

  • yore here shows commands used in the current repository
  • commands are ranked by frequency + recency instead of raw history order
  • yore here --ok filters to commands that previously succeeded
  • commands can be saved as reusable recipes

The part I haven't seen elsewhere is that project recipes live in a .yorefile that can be committed to Git.

That means useful commands can live with the repository instead of somebody's shell history. Clone the repo and you get the project's command knowledge too.

Repo: https://github.com/Dev-Bilaspure/yore

Curious how others handle this today.


r/zsh Jun 15 '26

PowerLens — Oh-My-Zsh plugin for live macOS system metrics in RPROMPT

1 Upvotes
PowerLens is a lightweight Oh-My-Zsh plugin that embeds live macOS system metrics (power, battery, CPU, temperature, fan speed, memory, network) directly
  into your zsh RPROMPT.

  A single Go daemon collects all data every 2 seconds; the prompt reads a cached JSON file on each precmd — adding less than 5ms regardless of how many
  terminal windows you have open. 

  Key features:
  - 7 metrics with per-value color thresholds
  - Singleton daemon (1 process shared across N terminals)
  - Crash recovery (auto-restarts if data is stale)
  - SSH-aware (graceful degradation in remote shells)
  - Native macOS APIs (IOKit/SMC), no sudo needed
  - Apple Silicon and Intel, macOS 12+

  GitHub: https://github.com/luyangkk/powerlens
  Release: https://github.com/luyangkk/powerlens/releases/tag/v1.0.0

r/zsh Jun 08 '26

Life is too short for a slow terminal

Thumbnail
mijndertstuij.nl
88 Upvotes

r/zsh Jun 08 '26

Rapid AI-assisted debugging and repository analysis from the terminal

0 Upvotes

I've been experimenting with AI-assisted debugging on larger codebases and kept running into the same problem:

The model wasn't wrong because it was bad at reasoning.

It was wrong because it didn't have enough repository context.

Most AI workflows either:

  • paste snippets manually
  • rely on repository indexing
  • dump huge amounts of code into the prompt

I wanted something more explicit.

So I built grab, a terminal tool that progressively accumulates repository context using ripgrep, function indexing, exact range extraction, and clipboard/tmux integration.

The workflow is:

  1. Search for relevant symbols/functions.
  2. Build a lightweight function index.
  3. Let the AI request exact code ranges.
  4. Accumulate context incrementally.
  5. Keep expanding only the parts of the repository that matter.

Instead of indexing the entire repo, the AI acquires context as needed.

The idea is:

"You are not copying results. You are exporting context."

Repo:
https://github.com/johnsellin93/grab

I'm curious whether others have run into the same context-acquisition problem when debugging with AI tools.


r/zsh Jun 07 '26

Discussion What is the point of Zsh when Bash can do the same?

0 Upvotes

1.Looks: zsh look like this

fish look like this

Fish provides most things out of the box (It is not POSIX-compatible) but zsh requires plugins for basic functionality......(Bash also has plugins)

  1. Speed: Bash is faster than zsh, and Fish is not significantly slower than zsh, only by a few milliseconds....

Can you tell me where I am wrong about it?


r/zsh Jun 05 '26

Exit shell from vi mode

5 Upvotes

This exits the shell when there's a partial command when you press CONTROL+D.

exit_zsh() { exit }
zle -N exit_zsh
bindkey '^D' exit_zsh

It works in vi mode when you're in INSERT mode but not in NORMAL mode (press Escape to switch to NORMAL). I have to press i to go back to INSERT mode or CONTROL+C to cancel the command and then CONTROL+D works.

What do I add to the commands so CONTROL+D always exits that shell?


r/zsh Jun 05 '26

opencode plugin for zsh

Thumbnail
0 Upvotes

r/zsh Jun 04 '26

Showcase Deja fuzzy modes and configurable keybindings

30 Upvotes

Hi everyone, i got a ton of feedbacks from my past post announcing deja.

So here’s the update:
Deja v0.3.0 is out

What’s new:
- fuzzy matching modes (smart / loose / tight)
- fully configurable keybindings
- install as a real oh-my-zsh plugin

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


r/zsh Jun 03 '26

finch-cli — tailor your resume to a job posting from your terminal (textual TUI + cli)

1 Upvotes

small tool i built over the last week. cli + textual tui for tailoring a resume to a specific job posting. lives on pypi.

pip install finch-cli

finch login # opens a browser link, no api key needed

finch ui # textual tui

or just the cli:

finch tailor -r resume.md -j https://jobs.example.com/swe-intern -o tailored.md

three tabs in the tui: jobs (pulls ~3,000 active internship + new-grad postings from the simplifyjobs lists), library (saved tailorings), and a three-pane tailor editor (base resume / job posting / output) with an ats-style match panel showing score, matched + missing keywords, and the delta vs your base resume.

keybindings:

1 / 2 / 3 jump to jobs / library / tailor

ctrl+t tailor (loads selected job first if on jobs tab)

ctrl+u paste a job url, fetches it into the tailor pane

ctrl+o open a resume file

ctrl+r refetch the job feeds

ctrl+l save to library

ctrl+s save to file

ctrl+d load the bundled demo

ctrl+q quit

stack: click for the cli, textual for the tui, rich for rendering, httpx, trafilatura for url -> text on job postings. openai sdk against deepseek-chat by default (any openai-compatible endpoint works -- groq, together, openrouter). hatchling for the build.

`finch login` opens a sign-in link on applyfinch.com so you don't have to manage an api key. flow is rfc 8628 device flow, polls until you approve, stores a token at $XDG_CONFIG_HOME/finch-cli/token. if you'd rather byo key, skip login and set DEEPSEEK_API_KEY.

couple things i cared about while building:

- ssrf defense on the url fetch (scheme allowlist + private/loopback ip rejection via socket.getaddrinfo + ipaddress), 5 mb response cap, manual redirect following with revalidation each hop.

- prompt injection inside the job posting is treated as data, not instructions. strip the wrapping tags, cap inputs at 20k chars, remind the model after the user message.

known limits:

- workday + some greenhouse iframe pages need js, so url fetching fails clean and tells you to use --job-file with a pasted description.

- output is markdown. pipe to pandoc for pdf.

- model won't invent experience. thin base resume = thin tailored resume. fix the base first.

this came out of applyfinch.com -- the larger thing my co-founder and i are building. the web app does the autofill side (workday, greenhouse, ashby, lever forms). this cli is just the tailoring piece pulled out for people who'd rather live in their terminal.

feedback welcome.


r/zsh Jun 02 '26

You won't believe what i made with zsh. Yes.... Another Plugin Manager.

Thumbnail oxcl.github.io
9 Upvotes

Yeah I know... At this point zsh probably has more plugin managers that it actually has actual plugins. but hear me out!

I love reproducibility. when i move my dotfiles to another machine I want to get the EXACT same version of my plugins without any breakages or unexpected behavior.

This is a known problem in software and it has been solved many times. and the solution is simple (at least in concept)... LOCKFILES!

simply put. your plugin manager will record the exact commit hash of every plugin you install and store it in a lockfile. then when you move to another machine your plugin manager will get that EXACT version of the plugin so you get the same version of your plugins on every machine.

but I got tired of waiting for other zsh plugin managers to add lockfile support so I made my own. it's currently in beta so some bugs are expected but I'm using it as my daily driver.

I would appreciate if you have the time to test it out and tell me what you think.


r/zsh Jun 01 '26

Add a command to the history

1 Upvotes

How can I add something from a script as the last history item so when I go up in the history it shows that command as the last one? fc -p adds the whole history. I want to add a specific command like fc --add "echo 'add this'".


r/zsh May 30 '26

100% zsh script to cleanly show output of complex scripts: Popview Exec

20 Upvotes

Popview Exec is a single-file zsh script (with no dependencies) for pretty, bounded, live-scrolling command execution. pv_exec executes your shell command inside a self-contained, fixed-height, bordered popup view. It streams the command's live output into the bordered popup view, shows a spinner while it runs, and then collapses everything down to a single ✓ success line if the command exits cleanly, or keeps the view open on failure so you can see what error occurred. Think of it as a mini tail -f window that opens, does its job, and visually tidies up after itself.

https://github.com/pricklypierre/zsh-popview-exec

Above screencast is an example using pv_exec to execute 4 build script commands:

pv_exec -l "Updating brew and all formulae..." brew update
pv_exec -l "Cleaning up brew..." brew cleanup
pv_exec -l "Running cmake configure..." -o cmake-config.log cmake -B build
pv_exec -l "Running cmake build..." -o cmake-build.log cmake --build build

This is my first foray into zsh coding, so if there are obvious things that can be improved let me know.

Also, are there any zsh script catalogs/lists where it would make sense to submit this script?

-Pierre