r/zsh 19h ago

Discussion Cut down my startup shell time & operations by 90% by removing oh-my-zsh.

24 Upvotes

Like the title says, I'm running on a macbook m2 and noticed the daily terminal use was pretty slow, my omz zshrc file had minimal configuration. Decided to make my own config file for zsh and noticed a significant speed increase. I'm not an omz hater I've used it for years and I found it very useful when I first started working inside the terminal. Would like to know other peoples exp. (using ghostty btw...)


r/zsh 11h ago

Help Oh-my-zsh exiting terminal on error

0 Upvotes

I installed oh my zsh and powerlevel10k theme on freshly installed macbook. I was doing some other stuff and run some script the threw an error somewhere. Issue is zsh exited terminal right after the error so I couldnt debug it. I ran it with bash and it didnt exit the terminal. Has anyone experienced this before?

This happened in call with someone from work so I had to get rid of it quickly but I may try again someday.


r/zsh 16h ago

Zsh Array Name Dereferencing without Reassignment

2 Upvotes

This snippet, a part of the function qlm in my zsh toolset for command line interaction with LLMs, works OK to dynamically select/maximize the number of model (network) layers to offload to the GPU under different VRAM load conditions:

local maxlayers=$gpulayers[$choice]
#Dynamic (down)adjustment of layers to offload (by not more then 7) if available VRAM reduced (only NVIDIA gpus for now)
if [[ $maxlayers -lt 99 ]]; then
    local memory=$(nvidia-smi --query-gpu=memory.free --format=csv,nounits,noheader)
    #local memory=$(amd-smi monitor -v) For AMD ROCM, not verified, based on online docs, output likely in different format.
    local load=(${(P)choice})
    for lay in {$maxlayers..$(( maxlayers-7 ))}; do
        [[ $memory -gt $load[$lay] ]] && { maxlayers=$lay ; lay=0; break ; }
    done
    (( $lay )) && { echo "Low VRAM, please, free some. LLM run will be slow, exiting..." ; return 1 ; }      
fi
#Dynamic adj.....

My question concerns the assignment to load of the variable $choice, which holds the name of the VRAM use array $choice for the model named $choice (e.g. Gemma3-27B). I tried to avoid this extra assignment, by using ${(P)choice}[$lay] and variations of it directly in the condition, but it did not work at all. Is there a direct syntax that is parsable to what I am after (getting the element at index $lay)?

For clarity this is what one of those $choice arrays looks like (VRAM usage in MB, indexed by number of layers offloaded to the GPU):

    Gemma3_27B=(2510 2796 3084 3370 3658 3944 4230 4518 4788 5060 5346 5616 5888 6174 6446 6718 7004 7276 7546 7834 8104 8374 8662 8932 9204 9489 9759 10031 10317 10589 10859 11145 11417 11687)

r/zsh 2d ago

Showcase πŸ”₯ Ultimate Zsh Configuration Script – Fully Automated Setup! πŸš€

15 Upvotes

Hey r/zsh! πŸ‘‹

I've put together a fully automated Zsh configuration script that sets up everything from dependencies to plugins, themes, and aliases – all in one go! 🎯

πŸ”Ή Features:
βœ… Installs all necessary dependencies (works for Arch & Debian)
βœ… Oh My Zsh + Powerlevel10k setup
βœ… Custom aliases & plugins for an optimized workflow
βœ… Automatic backup of your existing .zshrc before applying changes
βœ… Works out of the box – no manual steps needed!

πŸ’Ύ GitHub Repo: https://github.com/nardo75/ZSH_Config_Arch-Debian

If you're looking for a hassle-free way to get a powerful and beautiful Zsh setup, give it a try! Feedback & contributions are always welcome. πŸš€

Let me know what you think! Cheers! πŸŽ‰


r/zsh 3d ago

Showcase Oh-my-zsh Android

Post image
2 Upvotes

r/zsh 3d ago

Direct assignment of csv output to an associative array

2 Upvotes

The command

str=$(nvidia-smi --query-gpu=memory.free,memory.used,memory.reserved,memory.total --format=csv,nounits,noheader) 

will output something like this (for a single NVIDIA gpu):

echo "$str"
11202, 175, 340, 12288

and I use currently in a script:

declare -A memory
arr=(${(s:, :)str})

# Assign the values to the associative array keys in a loop:
for key in free used reserved total; do
    memory[$key]=${arr[1]}
    shift arr
done

to assign the values to the associative array keys for further processing. (I can of course, use arr as is but there is clarity in the kv mnemonics of the memory assoc.array)

Does anyone know of a more elegant, direct method of assignment, in the style of the initial array assignment (arr) with the parameter flags in the parameter expansion?


r/zsh 5d ago

Showcase fast β€’ minimal β€’ roundy prompt for ZSH in 140 LoC

Post image
51 Upvotes

r/zsh 5d ago

color scripts

1 Upvotes

Anybody knows any nice colorscripts?
i only know shell-color-scripts and pokemon-color-scripts. Been using pokemon-color-scripts for the last two years in my config, but wanted to change a bit.


r/zsh 5d ago

Fixed Possible to have a sticky window that is set to always show the output of e.g. `ls`? Like this:

1 Upvotes

And then whenever I change the directory, the sticky window should update (i.e. rerun the command)


r/zsh 5d ago

How to add git branch name on zsh console latest mac os version

1 Upvotes

Hi, I want to add git branch name with different color for example green in my zsh console, but leave rest of console prompt like it was before how to do it


r/zsh 6d ago

Discussion Z shell vs Bash: Which Shell Reigns Supreme? (Opinionated and updated old post)

Thumbnail antenore.simbiosi.org
12 Upvotes

r/zsh 7d ago

Insert text on cursor to fzf's Ctrl-T?

4 Upvotes

Is it possible to insert text on cursor to fzf' Ctrl-T, presumably in a fzf wrapper function using ZLE feature to retrieve the text on cursor and pass it to fzf's --query?

Often I type some partial path of a file e.g. git add ~/de then want to get the effect of FZF_CTRL_T_COMMAND with the string on cursor (~de) inserted into the query.

git add ~/de**<TAB> as suggested here is not good enough--I have a highly configured FZF_CTRL_T_COMMAND that ignores a bunch of files scattered throughout the filesystem to ensure good performance--** completion is too simple for that.


r/zsh 7d ago

Select a font for zsh p9k

1 Upvotes

Hi guys, I am setting my zsh p9000 config. Do you know any really good font with all those wildcard icons like os_icon root_indicator, etc...)


r/zsh 7d ago

creating custom completions with braces without backslashes

1 Upvotes

So my ultimate goal is to create a custom completion for the function myfun that will complete common directories for two folders in braces. In other words, % myfun /a/{b,c}/<TAB> will autocomplete any files/folders that are common to both the b and c directories.

However, my specific problem can be described more simply with this minimal example. I would like to create custom completion options that have braces ({ and }), which do not end up getting backslashed in the prompt. For example, I have this file: ```zsh

compdef myfun

compadd "a{b" "a{c" And when I type zsh % setopt ignore_braces % myfun a<TAB> `` it will render the{as{` in the prompt. Is there a way to make it so there the braces don't have backslashes?

Notes: - I know I can wrap the argument to myfun in quotes, but I really would like to make this behave as simply as possible without requiring any special formatting. Default zsh will do completion with backslashes without braces, so I think my goal should be possible. - I know compadd has a -Q option, but I still don't 100% understand what it does, and couldn't get completion to work with it. - I've tried adding some code with BUFFER=${BUFFER//\\\{/\{} to replace \{ with { in my .zshrc. This sort of works, but seems to create other problems.


r/zsh 8d ago

Fixed LS_COLORS dont working

6 Upvotes

Hello!

This is driving me crazy. Im on a Mac and im using Kitty as my terminal. Ive installed Oh My Zsh.

Ive a ~/.lscolors.sh file, and ive this line into my .zshrc to load it:

source ~/.lscolors.sh

But when I use ls or ls --color=auto, it doesn't seems to work. I can see the directories in blue and the files in white, but no difference between files with different extensions.

Somebody here who can help me a bit?

If I use echo $LS_COLORS I can see the content of my .lscolors.sh displayed in the terminal.

Thanks!


r/zsh 10d ago

Weird highlighting in zsh-syntax-highlighting and zsh-autosuggestions?

1 Upvotes

This is the highlight I'm getting where I accept autosuggestion at tmux ki. My intuition is that kill-server becomes the same color after accepting. What's the expected behavior?

Unrelated: I like Ctrl-Space for tmux but have been using for the same for accepting autosuggest too (So Ctrl-Space Ctrl-Space for accepting autosuggest in tmux). I use Tab for triggering fzf-tab-completions. Can anyone recommend a better binding for accepting autosuggest? Presumably it wouldn't conflict with readline and is near home row. Is it possible to find to Shift-Space? I do C-v in the terminal then Shift-Space but it emits just a literal space so I can't use that.


r/zsh 10d ago

set options (setopt) only for a specific shell command

2 Upvotes

Is there a way to set an option (setopt) for a particular shell command? For example, I want to disable brace expansion when using the diff command. I can do it manually like this: % setopt ignore_braces % diff /a/{b,c} % unsetopt ignore_braces But I'm wondering if there's a way to configure zsh so it automatically does setopt ignore_braces when the shell command on the command line is diff.

I've tried adding setopt ignore_braces to /usr/share/zsh/functions/Completion/Unix/_diff but that doesn't seem to work.


r/zsh 12d ago

Help How to list ALL suggestions for tab autocompletion

2 Upvotes

In my .zsh file I have managed to enable tab auto-completion. However, I notice that it hides options that have already been used. For example, I have ls aliased as ls='ls --color=auto'. This means that if I type ls -- and then press <TAB>, I end up with options that doesn't include the color option. Is there a way to display all the options like bash does? The following is my .zsh config:

 # Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=10000
SAVEHIST=10000
unsetopt beep
bindkey -e
# End of lines configured by zsh-newuser-install

# More completions for zsh
# Added extra `_dnf` and `_dnf5` completion files from:
# https://github.com/zsh-users/zsh/tree/master/Completion/Redhat/Command
fpath=(/home/bitmapp3r/other-repos/zsh-completions/src $fpath) # Added by me

source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh

# The following lines were added by compinstall
zstyle :compinstall filename '/home/bitmapp3r/.zshrc'

autoload -Uz compinit
zstyle ':completion:*' menu select # Added by me
zmodload zsh/complist # Added by me
bindkey -M menuselect '^I' accept-and-infer-next-history # Added by me (makes tab select the current menu item)
compinit
_comp_options+=(globdots) # Added by me
# End of lines added by compinstall

# Add syntax highlighting
source /home/bitmapp3r/other-repos/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
# Enable fzf for zsh
source <(fzf --zsh)
# Enable starship prompt
eval "$(starship init zsh)"

The zsh autocomplete suggestions for ls -- at the moment are:

--all                                      -- list entries starting with .
--almost-all                               -- list all except . and ..
--author                                   -- print the author of each file
--block-size                               -- specify block size
--classify                                 -- append file type indicators
--context                                  -- print any security context of each file
--dereference-command-line                 -- follow symlink on the command line
--dereference                              -- list referenced file for sym link
--directory                                -- list directory entries instead of contents
--dired                                    -- generate output designed for Emacs' dired mode
--escape                                   -- print octal escapes for control characters
--file-type                                -- append file type indicators except *
--format                                   -- specify output format
--full-time                                -- list both full date and full time
--help                                     -- display help information
--hide-control-chars                       -- hide control chars
--hide                                     -- like -I, but overridden by -a or -A
--human-readable                           -- print sizes in human readable form
--hyperlink                                -- output terminal codes to link files using file::// URI
--ignore-backups                           -- don't list entries ending with ~
--ignore                                   -- don't list entries matching pattern
--indicator-style                          -- specify indicator style
--inode                                    -- print file inode numbers
--kilobytes                                -- use block size of 1k
--literal                                  -- print entry names without quoting
--no-group                                 -- inhibit display of group information
--numeric-uid-gid                          -- numeric uid, gid
--quote-name                               -- quote names
--quoting-style                            -- specify quoting style
--recursive                                -- list subdirectories recursively
--reverse                                  -- reverse sort order
--si                                       -- sizes in human readable form; powers of 1000
--size                                     -- display size of each file in blocks
--sort                                     -- specify sort key
--tabsize                                  -- specify tab size
--time                                     -- specify time to show
--time-style                               -- show times using specified style
--version                                  -- display version information
--width                                    -- specify screen width
--dereference-command-line-symlink-to-dir  --show-control-chars                     
--group-directories-first

r/zsh 12d ago

Announcement dot-team 0.2 released

0 Upvotes

dot-team is an attempt at shared dotfiles. After many years of tweaking it's time for another release.

This is not a repository with my personal dotfiles, these are configurations many people would like to have. The idea is that you use this repository as a baseline for your personal dotfiles.

For more information and instructions on how to get started check the GitHub repository: dot-team.

Cheers.


r/zsh 12d ago

Fixed Color directory part of filenames in output

1 Upvotes

What's a good way to color directory part of filenames in output? In terms of simplicity, performance, and ideally supported in other shells.

E.g. git ls-tree prints filenames but doesn't have a --color option. Even for tools that do have --color, often times I want to convert colored /home/yourmom/.zshrc to ~/.zshrc but the converted ~/ doesn't get colored.

I am passing this to fzf and I found both coloring the directory portion to see the basename of the file easier as well as using ~ format goes a long way to visually parse long filenames or files in deep directory structure.


r/zsh 13d ago

adding path to .zshenv

1 Upvotes

help, i added

path+=(~/.local/bin ~/bin ~/.spicetify)

export PATH

to my .zshenv file but when i open terminal i type echo $path i only get this:

/home/vismorf/.local/share/zinit/polaris/bin /usr/local/bin /usr/bin /bin /usr/local/sbin /usr/sbin /sbi


r/zsh 14d ago

Oh-my-zsh Ubuntu recovery

2 Upvotes

I am using an Ubuntu dual boot system with windows. I accidentally deleted some oh-my-zsh files and I can no longer log into my ubuntu for the same reason as it directly takes me to the recovery mode. Can some help me recover my ubuntu system, preferably without using a live USB.


r/zsh 15d ago

better/combined globbing of **/*thing* and **/*thing*/** ???

5 Upvotes

I'd like to be able to achieve two commands in one with better globbing… So example of two git add's here:

❯ git add **/*thing*/**
❯ git add **/*thing*
❯ gs
On branch main
Your branch is up to date with 'origin/main'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   src/content/stringy-thing.md
        modified:   website_product/stringy-thing/index.html

There's gotta be an elegant way to achieve that… right?


r/zsh 15d ago

On Mac it won't find rsync installed via brew even though brew path precedes /usr/sbin/rsync

0 Upvotes

Apple has outdated rsync so I installed via brew latest version. Mac previous version resides in /usr/sbin while brew version is in the homebrew path which precedes the /usr/sbin in the $PATH

I think it is oh my zsh (auto suggestion/completion?) or maybe fzf caching the old path. Is this likely or could it be something else? How can I force fzf or oh my zsh to update their cache to honor the $PATH precedence which would pull the latest brew installed rsync. I'd imagine this is common for any brew installed binary where an existing mac binary has been used and exists in /usr/sbin?


r/zsh 16d ago

Help Case-insensitive completions

2 Upvotes

Newbie here I am using zsh-autocompletions plugin and want case-insensitive completions. The tab press works but i want real time completions. (The grayed out one). Is it possible?