Update cheatsheets

This commit is contained in:
ivuorinen
2026-02-08 00:34:23 +00:00
parent c8acbc5872
commit a9c8ccc0e2
34 changed files with 357 additions and 49 deletions

34
tldr/autoload Normal file
View File

@@ -0,0 +1,34 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# autoload
> Mark functions for lazy loading in Zsh.
> Functions are not loaded into memory until first called, improving shell startup time.
> More information: <https://zsh.sourceforge.io/Doc/Release/Shell-Builtin-Commands.html>.
- Autoload a function by name:
`autoload {{function_name}}`
- Autoload a function and immediately resolve its definition:
`autoload +X {{function_name}}`
- Autoload a function using Zsh-style autoloading (recommended):
`autoload -Uz {{function_name}}`
- Make functions from a directory available by adding it to `fpath`:
`fpath=({{path/to/functions_dir}} $fpath) && autoload -Uz {{function_name}}`
- Autoload the Zsh completion system:
`autoload -Uz compinit && compinit`
- Autoload and use the `add-zsh-hook` utility:
`autoload -Uz add-zsh-hook`