1
0
Fork 0
mirror of https://github.com/zdharma-continuum/zinit-module.git synced 2024-11-21 13:27:58 +01:00
zsh module for automatically compiling sourced files
Find a file
vladislav doster 08c2af35b4
Merge pull request #7 from zdharma-continuum/ci/gh-action-lint-workflow
feat: add lint gh action workflows
2023-04-14 17:18:39 -05:00
.github/workflows feat: add lint gh action workflow 2023-04-14 17:15:13 -05:00
Config 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00
images First commit 2021-11-17 19:11:43 +01:00
scripts fix broken mod-install.sh (#5) 2022-02-14 15:16:33 +01:00
Src 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00
Test 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00
.gitignore 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00
.preconfig 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00
aclocal.m4 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00
aczsh.m4 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00
config.guess 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00
config.h.in 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00
config.sub 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00
configure 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00
configure.ac 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00
install-sh 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00
LICENSE First commit 2021-11-17 19:11:43 +01:00
Makefile.in 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00
patch_cfgac.diff 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00
README.md feat: add lint gh action workflow 2023-04-14 17:15:13 -05:00
stamp-h.in 🧹 Clean up! (#1) 2021-11-19 10:14:34 +01:00

Zinit Module

MIT License Join the chat at https://gitter.im/zdharma-continuum/zinit

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

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:

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

zinit module build

This command will compile the module and display instructions on what to add to ~/.zshrc.

Measuring Time of sources

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:

typeset -g ZINIT_MOD_DEBUG=1