My Zsh configuration. Fast, convenient, and pretty.
-
Plugin manager: Zi
This is the better-maintained but less popular resurrection of zdharma/zinit, f.k.a. zdharma/zplugin.
-
Powerlevel10k Instant Prompt provides an instantly interactive prompt while
zshrc
is loading. -
Zi's internals and features are highly optimized for performance, especially at load time.
-
It compiles all plugins' Zsh scripts to Zsh word code (
[…].zwc
). -
Zi light loading and turbo mode are employed for fast and asynchronous loading of plugins.
-
All completion files (including those installed system-wide and those generated by external tools) are managed by Zi.
zicompinit_fast
is employed (invoked asynchronously) so that.zcompdump
is generated oncompinit
only once a day.
-
-
Zsh features are employed instead of alternatives that entail subprocesses, subshells, I/O, and other slow operations.
For example:
-
Zsh expansions and arrays are favored over forking subshells to execute
head
,tail
,cut
,grep
,sed
, and the like. -
Command existence is checked/resolved via
$commands
(a fast hash lookup) rather than forking a subshell to executecommand -v
(a slow interrogation of the filesystem) orwhich
(likewise, but with an additional program execution).
-
-
Fetched and generated files (e.g. completions, themes) are cached and only refreshed on explicit update.
-
Useful and sensible settings for Zsh options and Zsh parameters.
-
Conformance to the XDG Base Directory Specification (as much as possible) in order to provide a clean and consistent home directory layout
- For the full effect, install my
XDG Base Directory
environment.d
configuration in~/.config/environment.d/
.
- For the full effect, install my
XDG Base Directory
-
Zi update (
zi-update
, aliaszup
) handles all updates, including refreshing the cached instances of fetched/generated files. -
Completions for all the things:
-
Fancy completions configuration via zsh-fancy-completions
-
System-wide completions managed by Zi via system-completions
-
Additional completions via zsh-completions
-
Generated completions:
-
Python CLI apps via shtab
-
cog
-
elm
via kraklin/elm.plugin.zsh -
kdesrc-build
-
pip
,pipenv
,pipx
-
pnpm
-
rye
-
-
-
Auto-suggestions via zsh-autosuggestions
-
Multi-word history search via H-S-MW
This is the better-maintained but less popular resurrection of zdharma/history-search-multi-word.
-
Common-sense integrations:
-
Set terminal title
-
Sane paste behavior via
bracketed-paste-magic
-
Automatically detect and use
node_modules/.bin
-
-
Awesome helpers:
-
Help:
-
help
(alias:?
): Get help viarun-help
orman
-
ghcs-shell
/ghcs-gh
/ghcs-git
(alias:??
/??gh
/??git
): Request a shell/gh
/git
command from GitHub Copilot given a natural-language description -
sgpts
/sgpt4s
(alias:???
/????
): Request a shell command from GPT/GPT-4 via ShellGPT given a natural-language description
-
-
Filesystem:
-
in-dir
(alias:ind
): Run the given command in the given directory -
mkcd
: Create the given directory and change into it -
mktemp
/mktempd
: Create a temporary file/directory with the system'smktemp
command, but use$XDG_RUNTIME_DIR
as the default location -
pprint-file
(alias:pf
): Pretty-print a file -
diff-fancy
(alias:d
):diff --unified
piped throughdiff-so-fancy
-
-
Expressiveness:
-
Enabled from the community contributions bundled with Zsh:
-
throw
andcatch
-
zargs
-
zmv
and its siblingszcp
andzln
-
-
Higher-order functions via zsh-functional
-
-
Security:
wrap-with-secret-from-kwallet
: Wrap a command with an environment variable containing sensitive information (e.g. API key, password), retrieving the value from KWallet viakwallet-query
-
Introspection:
-
pprint-zfunc
(alias:pfn
): Pretty-print the source code of a Zsh function -
realcmdname
: Determine the real underlying command name invoked by a command (resolving aliases recursively, and ignoring various command prefixes)
-
-
-
Global preferences:
-
And more, via evil-registers, vi-motions, and vi-quote
-
Pager: bat
-
man
pager: Neovim -
Editor: Neovim
-
Browser: Firefox
-
-
Prompt theme: Powerlevel10k
-
Feature-rich syntax highlighting using F-Sy-H
This is the better-maintained but less popular resurrection of zdharma/fast-syntax-highlighting.
-
Auto-colorization of numerous commands' output via Generic Colouriser (
grc
) -
Auto-colorization and paging of
--help
output via a global alias that pipes it throughbat --plain --language=help
-
Catppuccin themes for all the things:
-
fzf via catppuccin/fzf
-
LS_COLORS
generated with vivid using the catppuccin-mocha theme. -
More in my dotfiles
Install my dotfiles. That's all!
Alternatively, include this configuration in your own chezmoi repository
using its corresponding chezmoi-external configuration
and ~/.zshenv
symlink.
git clone https://github.com/nisavid/zsh-config ~/.config/zsh
ln -s ~/.config/zsh/zshenv.zsh ~/.zshenv
zsh