feat: fish rprompt

resolves #1356
This commit is contained in:
Jan De Dobbeleer 2021-12-01 19:11:38 +01:00 committed by Jan De Dobbeleer
parent 894c678a50
commit 7fae781fff
2 changed files with 9 additions and 5 deletions

View file

@ -35,7 +35,7 @@ Tells the engine what to do with the block. There are three options:
- `prompt` renders one or more segments
- `rprompt` renders one or more segments aligned to the right of the cursor. Only one `rprompt` block is permitted.
Supported on [ZSH][rprompt], Bash and Powershell.
Supported on zsh, bash, PowerShell, cmd and fish.
### Newline

View file

@ -3,9 +3,9 @@ set -g POWERLINE_COMMAND "oh-my-posh"
set -g CONDA_PROMPT_MODIFIER false
function fish_prompt
set omp_status_cache $status
set omp_stack_count (count $dirstack)
set omp_duration "$CMD_DURATION$cmd_duration"
set -g omp_status_cache $status
set -g omp_stack_count (count $dirstack)
set -g omp_duration "$CMD_DURATION$cmd_duration"
# check if variable set, < 3.2 case
if set -q omp_lastcommand; and test "$omp_lastcommand" = ""
set omp_duration 0
@ -18,7 +18,11 @@ function fish_prompt
set -gx omp_last_status_generation $status_generation
end
::OMP:: --config $POSH_THEME --error $omp_status_cache --execution-time $omp_duration --stack-count $omp_stack_count
::OMP:: --config $POSH_THEME --shell fish --error $omp_status_cache --execution-time $omp_duration --stack-count $omp_stack_count
end
function fish_right_prompt
::OMP:: --config $POSH_THEME --shell fish --error $omp_status_cache --execution-time $omp_duration --stack-count $omp_stack_count --rprompt
end
function postexec_omp --on-event fish_postexec