8000 Allow updating fish_prompt after command (transient prompt) · Issue #7602 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

Skip to content

Allow updating fish_prompt after command (transient prompt) #7602

@IlanCosman

Description

@IlanCosman

I'm working on trying to replicate powerlevel10k's awesome transient prompt feature.

Here's my first stab:

function fish_prompt
    if set -q foo
        echo $foo
        set -e foo
    else
        echo $PWD
    end
end

function fish_preexec --on-event fish_preexec
    set -g foo bar
    commandline -f repaint
end

The logic is as follow:

  1. foo starts out undefined, so fish_prompt echoes $PWD
  2. Then you hit enter on a command, causing fish_preexec to run, which sets foo and reruns the prompt
  3. The prompt changes to $foo and erases it
  4. The command starts running

Thus the currently prompt will always be $PWD and all previous ones will be $foo

It doesnt work. Is there a way of doing what I want? If not, can it be added?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0