Commit graph

470 commits

Author SHA1 Message Date
Vladislav Doster cc3baf395f feat(self-update): support -n/--no-pager
Issue #632: the pager machinery already recognized -n/--no-pager
globally and .zinit-pager already honors OPTS[opt_-n,--no-pager], but
self-update rejected the flag with "Incorrect options given". Allow it
so the commit list can be printed straight to the terminal; help and
error output pick the flag up automatically from the option map. Also
offer the flag in the _zinit completion.

Closes #632

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2026-08-31 15:50:14 -05:00
Vladislav Doster 4819677018 refactor(ices): simplify the cwd helpers
Drop the anonymous-function indirection in .zinit-cd-quiet and pass --,
collapse the duplicated landing cd in .zinit-restore-dir, and convert the
six remaining hand-rolled copies of the idiom in zinit-install.zsh to the
named helper.

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2026-08-27 04:30:41 -05:00
Vladislav Doster ed80701426 fix(ices): expand the atinit'!' ice correctly
${ICE[atinit#!]} subscripts a literal "atinit#!" key and expands to
nothing, so atinit'!...' never ran for as"command" plugins.
${ICE[atinit]#1} stripped a leading "1" instead of "!", leaving the bang
in the evaluated code. Both now strip the prefix they meant to.

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2026-08-27 04:30:41 -05:00
Vladislav Doster 264526ab26 fix(ices): restore cwd even when the ice body cds
The ___moved guard skipped the restore whenever zinit did not cd
itself, so an ice body that cds under nocd stranded the shell wherever
the plugin left it. Make the restore unconditional and give
.zinit-restore-dir a fast path so the case where nothing moved stays
free.

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2026-08-27 04:30:41 -05:00
Vladislav Doster 712cac1952 fix(ices): restore $OLDPWD around plugin directory hooks
Every ice that runs code inside a plugin or snippet directory (atinit,
atload, multisrc, atclone, atpull, ps-on-unload) saved and restored $PWD
around the temporary cd, but never $OLDPWD. `cd -q' suppresses chpwd
hooks and `noautopushd' suppresses the directory stack, but neither
suppresses $OLDPWD, so the cd back left it pointing at the directory
just visited. Opening a new shell and pressing `cd -' jumped into a
zinit plugin directory without the user ever having gone there.

Add .zinit-cd-quiet/.zinit-restore-dir, which return to the original
$PWD by cd'ing through the original $OLDPWD for real. A plain $OLDPWD
assignment is not enough: `cd -' reads zsh's internal previous-directory
state, not the parameter, so assigning it leaves the parameter looking
correct while `cd -' still navigates to the plugin directory. When the
original $OLDPWD is empty or has since been deleted, bounce through
$PWD instead, which degrades `cd -' to a harmless no-op rather than
emitting an error and leaking the plugin directory anyway.

Also gate the restore on the cd having actually happened. It ran
unconditionally, so with the nocd ice -- where no cd takes place -- the
no-op cd back to $PWD still set OLDPWD=$PWD, silently discarding the
user's real previous directory.

Sites already protected by a real subshell, and the user-facing `zinit
cd' and `zinit create' commands that are meant to leave you in the
target directory, are left untouched.

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2026-08-27 03:28:26 -05:00
vladdoster 8f89f88cfd feat(zsh): allow configuring settings like HOME_DIR/BIN_DIR via zstyle
Resolve ZINIT[...] settings from `zstyle ':zinit:config' <attr>` before
the BIN_DIR/HOME_DIR/derived-dir logic runs. The attribute name is the
hash field lowercased with `_` replaced by `-` (HOME_DIR -> home-dir).

An explicitly-set ZINIT[KEY] always wins over zstyle, which wins over
the built-in default; fully backward-compatible.

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2026-06-18 19:05:42 -05:00
Agusti F. d2d4237715
fix: avoid apostrophe that breaks typeset -f round-trip of :zinit-tmp-subst-autoload (#783) 2026-06-15 13:54:18 +02:00
Andrea Alberti c51a835a21
Document the e- / no-e- prefix on atpull hook-group names, and fix a mislabeled section header (#781) 2026-06-01 09:05:22 +02:00
Andrea Alberti 27a0dc5527
## Fix extract ice not working during zinit update for from'gh-r' (#780) 2026-05-30 22:39:06 +02:00
Tom Hale 424b241bc7
feat: validate ice arguments (#778)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-24 10:09:43 +02:00
vladislav doster 91e8e6a65f
maint: remove duplicate .zinit-parse-opts call in self-update case block
- Removed since [`.zinit-parse-opts` is ran earlier](https://github.com/zdharma-continuum/zinit/pull/762/changes#diff-475a2f1e35813d9641ea77e854b9bf0d8c36b077bedbb6ae0bde1a0529dbbf0cR2634) in `zinit`
2026-03-03 09:22:24 +01:00
Andrea Alberti 1c0e24fca4
test: added tests for zinit self-update. Throw error if unsupported arguments are provided. 2026-03-03 09:22:24 +01:00
Andrea Alberti 95ba7d1dd4
refactor: implemented parsing of options for self-update using .zinit-parse-opts; extended number of supports variants, options
Follows suggestions from https://github.com/zdharma-continuum/zinit/pull/762#pullrequestreview-3811990006

Co-authored-by: vladislav doster <mvdoster@gmail.com>
2026-03-03 09:22:19 +01:00
Andrea Alberti 6cf2f2990d
fix: resolve a bug where the -q option for quiet mode was never dispatched 2026-03-03 08:44:44 +01:00
Nick Sherron 2167408db2
fix: prevent "permission denied" errors from empty hook handlers (#729)
Co-authored-by: Philipp Schmitt <pschmitt@users.noreply.github.com>
2025-08-12 20:39:35 +02:00
Kartik Yadav 6a51ac7125
Changes to create $ZSH_CACHE_DIR/completions directory (#708) 2025-05-24 06:52:57 +02:00
vladislav doster 947c1ba03d
feat: check for eza to use in $ZINIT[LIST_COMMAND] option (#636)
Co-authored-by: Philipp Schmitt <pschmitt@users.noreply.github.com>
Co-authored-by: HeroCC <HeroCC@users.noreply.github.com>
2025-01-26 00:18:35 +01:00
vladislav doster b7b8347cad
fix: compile command logic when using id-as ice (#619)
- Updated README.md `compiling` section
- Compile commands now work with `id-as` ice
- Compile command options added to tab completion  

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2024-03-03 23:43:48 -06:00
vladislav doster 6511ca7fe3
fix(configure ice): remove default --quiet flag (#637) 2024-02-20 04:28:11 -06:00
vladislav doster 353b3402f9
style: set log message prefix color to blue (#620)
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2024-01-13 22:08:30 -06:00
vladislav doster 22e66db478
feat: configure, make, cmake, and build ices (#613) (#616)
* Refactored 'configure' and 'make' ices
* New 'build' ice sets 'configure' and 'make ices if no flags are needed.
* New 'cmake' ice will build/install using 'cmake'
* Delete command now handles programs using 'make' and 'cmake' ices
* Setting `$ZINIT[DEBUG]` enables debug logging (i.e., `+zi-log "{dbg} message ..."`)
2024-01-09 04:11:39 -06:00
vladislav doster 8cf9104ac0
fix: handle zinit --help (#597)
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-12-04 05:30:34 -06:00
vladislav doster 3c7e5be07d
fix: debug logging logic and format (#592)
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-11-20 17:59:43 -06:00
vladislav doster e458e8288e
refactor: clist subcommand renamed to completions (#583)
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-09-30 18:46:19 -05:00
vladislav doster 14cc16167f
refactor: rename +zinit-message to +zi-log (#563)
- Rename all instances of +zinit-message to +zi-log
- Maintain compatibility with community plugins/annexes by forwarding +zinit-message calls to +zi-log

Signed-off-by: Doster, Vladislav <mvdoster@gmail.com>
2023-08-20 00:59:44 -05:00
vladislav doster 58736615f5
Merge branch 'main' into fix/logging 2023-05-04 06:43:27 -05:00
Vladislav Doster c4446da57e
fix: compile and completion log messages
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-05-04 06:37:30 -05:00
Vladislav Doster 930b25ee3c
feat: refactor debug commands
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-05-01 04:45:56 -05:00
Vladislav Doster 336ca85ade
fix: broken update command
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-04-19 12:20:09 -05:00
Vladislav Doster 6c82d6788d fix: cleanup style, naming, and completion
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-04-10 12:32:16 +00:00
Vladislav Doster a86590762a
feat: refactor ls, list, and loaded commands
Issues addressed:

1. Confusing and unintuitive command names

  Currently, two commands `loaded` and `list` will list installed
  plugins and a single command `ls` lists installed snippets. The namea
  don't make much sense or give context to their behavior, nor does
  having two commands with identical behavior.

This PR removes the three commands in favor of two new commands
`list-snippets` and `list-plugins`. The names align with the action they
perform.

2. Uninformative output

  Current output is hard to grok.

This PR cleans up the output format and uses color to help convey
information.

3. Incorrect

  Output does not account for various situations with the only way to
  fix is to reload Zsh session which would not always fix it. See images
  below for the aforementioned situations.

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-04-09 21:45:15 -05:00
Vladislav Doster 9eee215e3f
feat: delete subcommand refactor
- `delete` subcommand can now take multiple arguments
- improved logic for `--all`, `--clean` flags
- improved log output
- now cleans up broken symlinks

```
zinit delete <Plugin> <Plugin> ...
```

Closes #57
Closes #239

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-04-02 04:38:38 -05:00
Ryoga c624ac0077
add an option to disable aliases (#452)
* feat: add option to disable aliases

* docs: add docs for `ZINIT[NO_ALIASES]`
2023-03-26 22:54:30 +02:00
vladislav doster b5338e0252
Merge pull request #460 from psprint/%x-prompt-expn
fix: assign to functions hash to enable `%x`
2023-02-12 20:41:39 -06:00
Vladislav Doster cadeb791b4 refactor: zinit confirmation messages
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-02-12 18:01:43 -06:00
Sebastian Gniazdowski bd65a01734 fix: assign to functions hash to make %x work
The useful %x prompt expansion can be used to get path to the executed script:
0=${(%):-%x}

It is always the correct, expected value, even for autoloaded functions. However,
it currently doesn't work with Zinit special fpath-pollution free autoload.
This patch fixes this.
2023-01-13 16:34:03 +00:59
Vladislav Doster 515688bc97 revert: "Merge branch 'refactor/zinit-function-names' into main"
This reverts commit b979847bd4, reversing
changes made to da924a21a1.

I (@vladdoster) accidentally merged this into the wrong repository. Apologies for the lack of due diligence.
2022-12-17 21:11:41 -06:00
vladislav doster b979847bd4
Merge branch 'refactor/zinit-function-names' into main 2022-12-17 18:22:20 -06:00
Vladislav Doster bfb01e65d7 feat: display version via version sub command
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2022-12-17 06:14:46 -06:00
Vladislav Doster 2b460a74f2 fix: vim modelines & zsdoc pdf rendering
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2022-12-15 22:22:48 -06:00
Vladislav Doster 0e45493e36 fix: change prefix ~zi:: to __zi::
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2022-12-16 03:45:16 +00:00
Vladislav Doster 75bb73547e fix: file modelines
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2022-12-15 12:01:15 -06:00
Vladislav Doster c28580c3fc refactor: rename zinit functions
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2022-12-09 15:40:31 -06:00
Jan Katins 59975d70d7
feat: add completions ice (#417)
This can be used to overwrite `as'null'`, which would otherwise not trigger
completion detection and installation.

It will override the `nocompletions` ice when both are specified (e.g., using
the default ice annex).
2022-12-05 07:21:28 -06:00
vladislav doster cfd3261892
revert: "perf: reduce scheduler task check to 10 second interval (#429)" (#432)
This reverts commit 1681ce40eb.
2022-11-30 18:50:52 -06:00
Sebastian Gniazdowski 1681ce40eb
perf: reduce scheduler task check to 10 second interval (#429) 2022-11-30 14:55:38 -06:00
Vladislav Doster 0c1839a18b revert: "perf: decrease scheduler checks from every 1 second to 10 seconds (#409)"
This reverts commit 4938e84827.
2022-11-20 03:47:48 -06:00
Sebastian Gniazdowski 4938e84827
perf: decrease scheduler checks from every 1 second to 10 seconds (#409)
The scheduler is called in 10 seconds intervals when no tasks are present to lower CPU usage.

Co-authored-by: vladislav doster <10052309+vladdoster@users.noreply.github.com>
2022-11-19 23:21:38 -06:00
Aaron Lichtman 33fa18af98
Revert "Copy doc/zinit.1 only if it exists. Fixes #418." 2022-11-18 04:57:33 -08:00
Sebastian Gniazdowski 4bfc7ecbe3 Copy doc/zinit.1 only if it exists. Fixes #418. 2022-11-08 10:01:39 +00:59