- Shell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| yazi | ||
| zsh | ||
| .gitignore | ||
| DOCUMENTATION.md | ||
| install.sh | ||
| LICENSE | ||
| README.md | ||
| zshrc.example | ||
🥯 ButterZsh
A .zshrc split into small files you can actually read. No framework, no
plugin manager. You get a git-aware prompt, menu completion, syntax
highlighting and autosuggestions, fzf and zoxide wired in, and a handful of
functions worth having. Anything beyond that is opt-in.
Install
git clone https://justaguy.dev/drew/butterzsh.git
cd butterzsh
./install.sh
The installer offers to install zsh if it is missing, backs up your
.zshrc and any existing ~/.config/zsh, copies the new files in, installs
the tools and the two plugins it relies on through your package manager,
asks which optional alias modules you want, and offers to make zsh your
login shell. Start a new terminal when it finishes.
ButterZsh is also option 2 in the butterscripts optional tools menu.
To undo it, put the backup back:
cp ~/.zshrc.backup.<timestamp> ~/.zshrc
rm -rf ~/.config/zsh
What you get
Prompt
18:42:07 drew at box in ~/Code/butterzsh (main*)
✔ $
Time, user, host, directory, and the git branch with * when the tree is
dirty. The second line shows ✔, or ✘ and the exit code, for the last
command. [ssh] shows in red on remote sessions. Once per session a header
line prints the OS, kernel, window manager and zsh version.
Completion and plugins
Tab gives a menu you can arrow through, matching is case-insensitive, and
results are grouped and colored like ls. Commands turn green or red as you
type (zsh-syntax-highlighting) and a grey suggestion from your history
follows the cursor (zsh-autosuggestions); Right arrow or Ctrl+Space accepts it.
Aliases
The core set only changes how commands you already type behave, so there is nothing to memorize:
.. ... .... - |
up one, two, three, back |
ls l ll la lt lh |
eza with icons and directories first, plain ls if eza is missing |
cp mv rm mkdir |
ask before overwriting, rm -I, mkdir -p, all verbose |
df du free |
human-readable sizes |
grep |
color |
top |
btop, then htop, then top |
zshrc reload |
edit or re-source ~/.zshrc |
ff hi |
fastfetch, a desktop notification |
Global aliases expand anywhere on the line, which bash cannot do:
ls -la G pattern # | grep -i pattern
cat file L # | less
history T # | tail
some-command H # | head
some-command N # 2>/dev/null
curl url J # | jq
Everything else lives in modules. The installer asks about each one, and
modules manages them afterward:
modules # [on]/[off] for each module
modules enable git # takes effect now
modules disable git # gone in the next shell
| Module | Adds |
|---|---|
git |
g gs ga gaa gc gcm gp gpu gpl gco gb gd gl gclone |
apt |
inst search update upgrade remove uplist autoremove |
shortcuts |
editors v vv e n, one-letter x c h j, mem cpu biggest myip listening k9 now week, switch to bash and back |
A module is a file in ~/.config/zsh/optional/. Enabled means a symlink to
it sits in ~/.config/zsh/; only top-level files load.
Navigation
zoxide takes over cd. Full paths, - and .. work as before, and
cd <fragment> jumps to the best-matching directory you have been in.
cdi opens an fzf picker with a preview. Typing a directory name on its
own also changes into it, and cd pushes onto the directory stack so
popd walks you back.
y runs yazi and leaves the shell in whatever directory you quit from.
Functions
mkcd dir |
make it and go there |
extract file |
any archive: tar, gz, bz2, xz, zst, zip, rar, 7z |
backup file |
timestamped copy next to the original |
calc 2+2 |
bc with two decimals |
sysinfo |
host, OS, kernel, uptime, memory, load, disk |
psg name |
ps aux filtered, header kept |
hgrep term |
search history |
dirsize [dir] |
one number |
path |
PATH, one entry per line |
vf |
fzf a file with preview, open in $EDITOR |
fkill |
fzf a process, kill it |
Keys
Emacs bindings by default. Put bindkey -v in ~/.zshrc.local for vi mode.
| Up / Down | history filtered by what you have typed so far |
| Ctrl+R | fzf history search |
| Ctrl+T | fzf file picker, pastes the path |
| Alt+C | fzf directory picker, cd into it |
| Home / End | line start and end |
| Ctrl+Left / Right | by word |
| Ctrl+Backspace / Delete | kill word backward and forward |
| Ctrl+L | clear |
Shell options
History holds 10,000 entries in memory and 20,000 on disk, shared across every open terminal as you type, with duplicates and lines starting with a space dropped. Extended globbing is on, case-insensitive, and includes dotfiles. Comments work at the interactive prompt. No beeping.
Make it yours
- Any
*.zshfile you drop into~/.config/zsh/loads on the next shell.custom.zshis a fine name. ~/.zshrc.localloads last and is for machine-specific exports, aliases andbindkey -v. The installer never touches it.- The shipped files are short. Edit them.
Files
~/.config/zsh/
├── aliases.zsh core and global aliases
├── prompt.zsh prompt and session header
├── keybinds.zsh key bindings
├── fzf.zsh fzf options, vf, fkill
├── zoxide.zsh cd and cdi
├── yazi.zsh y
├── functions/
│ ├── system.zsh sysinfo, psg, modules, install_tools
│ └── utils.zsh mkcd, extract, backup, calc, hgrep, dirsize, path
└── optional/ modules, inert until enabled
├── git.zsh
├── apt.zsh
└── shortcuts.zsh
Requirements
Zsh 5 or newer. The installer pulls in fzf, ripgrep, fd, bat, eza, zoxide, zsh-syntax-highlighting and zsh-autosuggestions with apt, dnf, pacman, zypper or brew, cloning the two plugins from GitHub if your distro does not package them. Every module checks for its tool before doing anything, so a missing one just means that feature is off.
Not installed for you: yazi for y, and xclip or wl-clipboard for
clipboard use. A starter ~/.config/yazi/theme.toml that follows your
terminal colors is dropped in if you have none.
Related
- ButterBash, the same idea for bash
- butterscripts, Debian setup scripts that can install this
- ButterNotes, notes and todos from the shell
Contributing
Issues and pull requests at https://justaguy.dev/drew/butterzsh. For anything larger than a fix, open an issue first.
Support
Connect
- YouTube — tutorials and guides
- Butterforge — source code and projects
- Butter desktops — ready-to-use window manager desktops for Debian
- The Butter Lab — Discourse forum
- The Churn — community chat (Fluxer)
- Wiki — documentation and guides
- Mastodon — @justaguylinux@fosstodon.org
- Butterbian — a maintained Debian derivative built on Debian stable
License
GPL-2.0. See LICENSE.
Made with 🧈 by JustAGuyLinux
