
* 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>
1.4 KiB
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:
-
Place the file
async-git-prompt.nu
in the$nu.config-path
directory (this is the directory containinginit.nu
andenv.nu
). -
Use the command
async-git-prompt-string
in your ownPROMPT_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. -
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: -
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 . -
It will probably be convenient to alias this, e.g.
alias r = async-git-prompt-refresh-cache
-
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)