Need help with fish-async-prompt?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

acomagu
197 Stars 15 Forks MIT License 83 Commits 9 Opened issues

Description

Make your prompt asynchronous to improve the reactivity.

Services available

!
?

Need anything else?

Contributors list

# 245,518
Neovim
vim8
Go
Firebas...
47 commits
# 207,961
excel
pptx
ooxml
golang
3 commits
# 156,258
HTML
Django
C
Shell
2 commits
# 3,909
Shell
fish-sh...
vdom
elm
2 commits
# 204,541
Kotlin
coding-...
unittes...
Shell
2 commits
# 158,556
fish-sh...
Shell
fisher
C
1 commit
# 250,049
Markdow...
unified
fish-pl...
CSS
1 commit
# 35,715
Neovim
vim-plu...
golang
viml
1 commit

fish-async-prompt

Make your prompt asynchronous in Fish.

Description

Demo Video

We run your

fish_prompt
and
fish_right_prompt
functions as a separate process to update your prompt asynchronously.

Installation

With Fisher:

$ fisher install acomagu/fish-async-prompt

Loading Indicator

By default, it prints the previous prompt until the new one is ready. But you can change it to any other string. Define a function which named

_loading_indicator
, like
fish_prompt_loading_indicator
.

For example, to show

as the indicator of right prompt:
function fish_right_prompt_loading_indicator
    echo (set_color '#aaa')' … '(set_color normal)
end

demo1

You can also use the previous prompt string because the function receives it as the first argument. For example, show previous prompt but glayed out:

function fish_right_prompt_loading_indicator -a last_prompt
    echo -n "$last_prompt" | sed -r 's/\x1B\[[0-9;]*[JKmsu]//g' | read -zl uncolored_last_prompt
    echo -n (set_color brblack)"$uncolored_last_prompt"(set_color normal)
end

demo2

The loading indicator can be set up not only for

fish_prompt
or
fish_right_prompt
, but also for other function, if you specify it in
async_prompt_functions
. e.g.
function _git_branch_name
    sleep 1 # For demo.
    git symbolic-ref --short HEAD ^/dev/null
end

function fish_right_prompt echo (set_color 88f)(_git_branch_name) (set_color cyan)(prompt_pwd) end

Async prompt setup.

set async_prompt_functions _git_branch_name

function _git_branch_name_loading_indicator echo (set_color brblack)…(set_color normal) end

demo3

Other Configurations

If you have problems, try changing the values of these variables. When you change the configurations, please restart your shell.

async_prompt_inherit_variables

Define variables inherited to prompt functions. Set

all
to pass all global variables.

Default:

status SHLVL CMD_DURATION

Example:

set -U async_prompt_inherit_variables all

async_prompt_functions

Define functions replaced to run asynchronously. Usually one or both of

fish_prompt
and
fish_right_prompt
.

Other functions can be specified, but they must be called from

fish_prompt
or
fish_right_prompt
and function arguments can't be passed to it.

Default:

fish_prompt fish_right_prompt

Example:

set -U async_prompt_functions fish_right_prompt

async_prompt_internal_signal

fish-async-prompt uses SIGUSR1 to communicate with the spawned process by default. If it conflicts with other plugin/program, try changing this.

Default:

SIGUSR1

Example:

set -U async_prompt_internal_signal SIGUSR2

Author

License

MIT

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.