1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 23:27:45 +00:00
nu_scripts/modules/prompt/async_git_prompt/README.md
Mel Massadian c47ccd42b8
refactor: (#418)
* 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>
2023-04-25 17:56:25 -05:00

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:

  1. Place the file async-git-prompt.nu in the $nu.config-path directory (this is the directory containing init.nu and env.nu).

  2. 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.

  3. 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:

  4. 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 .

  5. It will probably be convenient to alias this, e.g.

    alias r = async-git-prompt-refresh-cache
    
  6. 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)