Show loading indicator in prompt whilst plugins are loading

This commit is contained in:
Jonny Barnes 2024-07-07 14:03:56 +01:00
parent 83b6e927c6
commit 95153292ea
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
4 changed files with 29 additions and 2 deletions

View file

@ -56,8 +56,15 @@ console_title_template = '{{ .Folder }}'
always_enabled = true
[[blocks]]
type = 'prompt'
alignment = 'right'
type = 'rprompt'
alignment = 'left'
[[blocks.segments]]
type = "text"
style = "plain"
foreground = "black"
background = "transparent"
template = "{{ if .Env.SHELL_LOADING }} loading {{ end }}"
[[blocks.segments]]
type = "executiontime"

View file

@ -10,6 +10,11 @@ shell = "zsh"
defer = """{{ hooks?.pre | nl }}{% for file in files %}zsh-defer source "{{ file }}"\n{% endfor %}{{ hooks?.post | nl }}"""
defer-more = """{{ hooks?.pre | nl }}{% for file in files %}zsh-defer -t 0.5 source "{{ file }}"\n{% endfor %}{{ hooks?.post | nl }}"""
# Loading indicator
# -----------------
[plugins.show]
local = "~/.zsh/plugins/loading"
# Completions
# -----------
@ -96,3 +101,10 @@ apply = ["defer-more"]
[plugins.ngrok]
local = "~/.zsh/plugins"
apply = ["defer-more"]
# Loading indicator
# -----------------
[plugins.hide]
local = "~/.zsh/plugins/loading"
apply = ["defer-more"]

View file

@ -0,0 +1,4 @@
#!/usr/bin/env zsh
# Hide the loading indicator
unset SHELL_LOADING

View file

@ -0,0 +1,4 @@
#!/usr/bin/env zsh
# Show the loading indicator
export SHELL_LOADING=true