Skip to content

Latest commit

 

History

History
326 lines (217 loc) · 11.2 KB

README.md

File metadata and controls

326 lines (217 loc) · 11.2 KB

🖳 Zsh Configuration

My Zsh configuration. Fast, convenient, and pretty.

☑️ Features

🫀 Core

⚡️ Performance

  • 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 on compinit 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 execute command -v (a slow interrogation of the filesystem) or which (likewise, but with an additional program execution).

  • Fetched and generated files (e.g. completions, themes) are cached and only refreshed on explicit update.

🏪 Convenience

  • 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

  • Zi update (zi-update, alias zup) handles all updates, including refreshing the cached instances of fetched/generated files.

  • Completions for all the things:

  • 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:

  • Awesome helpers:

    • Help:

      • help (alias: ?): Get help via run-help or man

      • 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's mktemp 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 through diff-so-fancy

    • Expressiveness:

      • Enabled from the community contributions bundled with Zsh:

        • throw and catch

        • zargs

        • zmv and its siblings zcp and zln

      • 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 via kwallet-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:

🦋 Visuals

🛠️ Installation

Installation Method: Using Chezmoi

Install my dotfiles. That's all!

Alternatively, include this configuration in your own chezmoi repository using its corresponding chezmoi-external configuration and ~/.zshenv symlink.

Installation Method: Manual

Clone the configuration

git clone https://github.com/nisavid/zsh-config ~/.config/zsh

Link .zshenv

ln -s ~/.config/zsh/zshenv.zsh ~/.zshenv

Start Zsh

zsh