メインコンテンツまでスキップ

⚙️ Modules

z-shell/zpmod

info
  • Required Zsh version: >= v5.8.1

🍎 Build (MacOS) 🐧 Build (Linux)

The module is a binary Zsh module transparently and automatically compiles sourced scripts and measures the time of each script sourcing.

Measuring Time of sources

zpmod <source-study> [options]

Option -l shows full paths to the files.

Issue zpmod source-study after loading the module at top of ~/.zshrc to see a list of files loaded via source or . builtins, with a duration that each loading lasted, in milliseconds. The module tracks all calls to those builtins and measures the time each call took. This can be used e.g. profile loading of plugins, regardless of the plugin manager used.

This feature allows profiling 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 😵‍💫

Extending Zi reports

zpmod <report-append> [options]

Used by zpmod internally to speed up loading plugins with tracking (reporting). It extends the given field {plugin-ID} in $ZI_REPORTS hash, with the given string {new-report-body}.

Debugging

To enable debug messages from the module set:

typeset -g ZI_MOD_DEBUG=1

Install zpmod

  • To start using the module run: zi module -B, append --clean to run make distclean.
  • To display the instructions on loading the module, run: zi module -I.
zi module [-B|--build[--clean]] [-I|--info] [-r|--reset] [-h|--help] [options]
zi module -B [--clean] # Build the module, append --clean to run distclean.
zi module -I # Display instructions on loading the module.
zi module -r # Check timestamps and rebuild the module if needed.

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

z-shell/zgdbm

Provides GDBM module as a plugin.

zstyles - The values being set are the defaults.

备注

Change the values before loading the zgdbm plugin.

~/.zshrc
zstyle ":plugin:zgdbm" cppflags "-I/usr/local/include"  # Additional include directory
zstyle ":plugin:zgdbm" cflags "-Wall -O2 -g" # Additional CFLAGS
zstyle ":plugin:zgdbm" ldflags "-L/usr/local/lib" # Additional library directory

Install zgdbm

zi light z-shell/zgdbm