Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zdharma-continuum/zinit-module
zsh module for automatically compiling sourced files
https://github.com/zdharma-continuum/zinit-module
zinit zsh zsh-module
Last synced: about 1 month ago
JSON representation
zsh module for automatically compiling sourced files
- Host: GitHub
- URL: https://github.com/zdharma-continuum/zinit-module
- Owner: zdharma-continuum
- License: other
- Created: 2021-11-17T17:15:43.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-14T22:18:39.000Z (over 1 year ago)
- Last Synced: 2024-11-05T13:42:55.676Z (about 2 months ago)
- Topics: zinit, zsh, zsh-module
- Language: C
- Homepage:
- Size: 792 KB
- Stars: 20
- Watchers: 5
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Zinit Module
[![MIT License][mit-badge]][mit-link]
[![Join the chat at https://gitter.im/zdharma-continuum/zinit][gitter-badge]][gitter-link]## Motivation
The module is a binary Zsh module (think about `zmodload` Zsh command, it's that topic) which transparently and
automatically **compiles sourced scripts**. Many plugin managers do not offer compilation of plugins, the module is a
solution to this. Even if a plugin manager does compile plugin's main script (like Zinit does), the script can source
smaller helper scripts or dependency libraries (for example, the prompt `geometry-zsh/geometry` does that) and there are
very few solutions to that, which are demanding (e.g. specifying all helper files in plugin load command and
investigating updates to the plugin – in Zinit case: by using `compile` ice-mod).![image](https://raw.githubusercontent.com/zdharma-continuum/zinit-module/HEAD/images/mod-auto-compile.png)
## Installation
### Without Zinit
To install just the binary Zinit module **standalone** (Zinit is not needed, the module can be used with any other
plugin manager), execute:```zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit-module/HEAD/scripts/mod-install.sh)"
```This script will display what to add to `~/.zshrc` (2 lines) and show usage instructions.
### With Zinit
Zinit users can build the module by issuing following command instead of running above `mod-install.sh` script (the
script is for e.g. `zgen` users or users of any other plugin manager):```zsh
zinit module build
```This command will compile the module and display instructions on what to add to `~/.zshrc`.
## Measuring Time of `source`s
Besides the compilation-feature, the module also measures **duration** of each script sourcing. Issue
`zpmod source-study` after loading the module at top of `~/.zshrc` to see a list of all sourced files with the time the
sourcing took in milliseconds on the left. This feature allows to profile the shell startup. Also, no script can
pass-through that check and you will obtain a complete list of all loaded scripts, like if Zshell itself was
investigating this. The list can be surprising.## Debugging
To enable debug messages from the module set:
```zsh
typeset -g ZINIT_MOD_DEBUG=1
```[gitter-badge]: https://badges.gitter.im/zdharma-continuum/zinit.svg
[gitter-link]: https://gitter.im/zdharma-continuum/community
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
[mit-link]: ./LICENSE