mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-03 07:37:47 +00:00

* refactor: ✨ move in one commit Eveything in modules should probably be changed to `exported` defs. The idea is to move everything first to keep proper history. * refactor: 📝 add modules readme (wip) * refactor: ✨ small move * refactor: 📝 changed nestring, updated modules readme * refactor: 📝 to document or not to document * fix: 🐛 themes replaced the template to use `main` and regenerated them from lemnos themes. * Revert "fix: 🐛 themes" This reverts commit 4918d3633c8d2d81950a0ed0cfd9eb84241bc886. * refactor: ✨ introduce sourced - Created a source `root` in which sourcable demos are stored. Some might get converted to modules later on. - Moved some files to bin too. * fix: 🐛 fehbg.nu * fix: 🐛 modules/after.nu * moved some other stuff around --------- Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
33 lines
1.4 KiB
Markdown
33 lines
1.4 KiB
Markdown
This module exports commands for creating a nushell prompt that computes git status (staged and
|
|
unstaged changes) asynchronously. This can be useful in large git repos when it is slow to obtain
|
|
this information synchronously.
|
|
|
|
To use this module:
|
|
|
|
0. Place the file `async-git-prompt.nu` in the `$nu.config-path` directory (this is the directory
|
|
containing `init.nu` and `env.nu`).
|
|
|
|
1. Use the command `async-git-prompt-string` in your own `PROMPT_COMMAND` (the file prompt.nu
|
|
contains an example of doing this.)
|
|
At this point, your prompt will be computing the information synchronously, because the cache
|
|
file does not yet exist.
|
|
|
|
2. In a repo where git is slow, run the command `async-git-prompt-refresh-cache`.
|
|
Now, your prompt will be fast, but it also won't update automatically. You could investigate a good
|
|
way to invalidate the cache automatically, but the manual alternative is:
|
|
|
|
3. Whenever you think your prompt might be stale, re-run the command `async-git-prompt-refresh-cache`.
|
|
Your prompt will update on one of the next times that you hit <enter>.
|
|
|
|
4. It will probably be convenient to alias this, e.g.
|
|
|
|
```nu
|
|
alias r = async-git-prompt-refresh-cache
|
|
```
|
|
|
|
5. To go back to synchronous mode, run `async-git-prompt-delete-cache`.
|
|
|
|
### TODO
|
|
|
|
- Automatic cache invalidation
|
|
- Show untracked files (this can be very expensive in large repos)
|