mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-18 02:09:49 +00:00
Compare commits
2 Commits
bf2948322b
...
5292fea2ba
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5292fea2ba | ||
|
|
4f8632db32 |
@@ -98,6 +98,25 @@ If you prefer to keep your prompt always up-to-date but still don't want to _fee
|
||||
your prompt asynchronous. This plugin doesn't do this automatically so you'd have to hack your theme a bit for
|
||||
that.
|
||||
|
||||
### Git async-prompt compatibility
|
||||
|
||||
If you use a wrapper function that calls `git_prompt_info` (as shown above), it won't work with
|
||||
the default git async-prompt mode. This is because async-prompt only registers its background worker
|
||||
when it detects `$(git_prompt_info)` literally in your prompt variables. A wrapper like
|
||||
`$(_my_theme_vcs_info)` won't match, so the async output stays empty.
|
||||
|
||||
To fix this, add one of the following to your `.zshrc` **before** Oh My Zsh is sourced:
|
||||
|
||||
```zsh
|
||||
# Option 1: force async handlers to always register (recommended, keeps async behavior)
|
||||
zstyle ':omz:alpha:lib:git' async-prompt force
|
||||
|
||||
# Option 2: disable async-prompt entirely (simpler, but prompt may feel slower in large repos)
|
||||
zstyle ':omz:alpha:lib:git' async-prompt no
|
||||
```
|
||||
|
||||
See [#13555](https://github.com/ohmyzsh/ohmyzsh/issues/13555) for details.
|
||||
|
||||
## See Also
|
||||
|
||||
- [martinvonz/jj](https://github.com/martinvonz/jj)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Pre-commit plugin
|
||||
|
||||
This plugin adds aliases for common commands of [pre-commit](https://pre-commit.com/).
|
||||
It also supports [prek](https://github.com/prek/prek) as a drop-in replacement.
|
||||
If `prek` is available, it will be used; otherwise, `pre-commit` is used as fallback.
|
||||
|
||||
To use this plugin, add it to the plugins array in your zshrc file:
|
||||
|
||||
@@ -11,9 +13,10 @@ plugins=(... pre-commit)
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| ------- | -------------------------------------- | ------------------------------------------------------ |
|
||||
| prc | `pre-commit` | The `pre-commit` command |
|
||||
| prcau | `pre-commit autoupdate` | Update hooks automatically |
|
||||
| prcr | `pre-commit run` | The `pre-commit run` command |
|
||||
| prcra | `pre-commit run --all-files` | Run pre-commit hooks on all files |
|
||||
| prcrf | `pre-commit run --files` | Run pre-commit hooks on a given list of files |
|
||||
| ----- | ------------------------------------------------------ | --------------------------------------------- |
|
||||
| prc | `prek` or `pre-commit` | The pre-commit command |
|
||||
| prcau | `prek auto-update` or `pre-commit autoupdate` | Update hooks automatically |
|
||||
| prcr | `prek run` or `pre-commit run` | The pre-commit run command |
|
||||
| prcra | `prek run --all-files` or `pre-commit run --all-files` | Run pre-commit hooks on all files |
|
||||
| prcrf | `prek run --files` or `pre-commit run --files` | Run pre-commit hooks on a given list of files |
|
||||
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
# Aliases for pre-commit
|
||||
alias prc='pre-commit'
|
||||
# Aliases for pre-commit (uses prek if available, else pre-commit)
|
||||
if command -v prek &> /dev/null; then
|
||||
_prc_cmd='prek'
|
||||
_prc_autoupdate='auto-update'
|
||||
else
|
||||
_prc_cmd='pre-commit'
|
||||
_prc_autoupdate='autoupdate'
|
||||
fi
|
||||
|
||||
alias prcau='pre-commit autoupdate'
|
||||
alias prc="$_prc_cmd"
|
||||
|
||||
alias prcau="$_prc_cmd $_prc_autoupdate"
|
||||
|
||||
alias prcr="$_prc_cmd run"
|
||||
alias prcra="$_prc_cmd run --all-files"
|
||||
alias prcrf="$_prc_cmd run --files"
|
||||
|
||||
alias prcr='pre-commit run'
|
||||
alias prcra='pre-commit run --all-files'
|
||||
alias prcrf='pre-commit run --files'
|
||||
|
||||
Reference in New Issue
Block a user