starship: adjust to work nicely in both dark and light mode

This commit is contained in:
Daniel Lundin 2024-06-01 12:50:32 +02:00
parent c23152556a
commit 4b9f5f3dc4
No known key found for this signature in database
2 changed files with 19 additions and 77 deletions

View file

@ -1,57 +0,0 @@
#!/usr/bin/fish
# SPDX-License-Identifier: CC0-1.0
if status --is-interactive
set _fishprompt_aid "fish"$fish_pid
set _fishprompt_started 0
# empty if running; or a numeric exit code; or CANCEL
set _fishprompt_postexec ""
functions -c fish_prompt _fishprompt_saved_prompt
set _fishprompt_prompt_count 0
set _fishprompt_disp_count 0
function _fishprompt_start --on-event fish_prompt
set _fishprompt_prompt_count (math $_fishprompt_prompt_count + 1)
# don't use post-exec, because it is called *before* omitted-newline output
if [ -n "$_fishprompt_postexec" ]
printf "\033]133;D;%s;aid=%s\007" "$_fishprompt_postexec" $_fishprompt_aid
end
printf "\033]133;A;aid=%s;cl=m\007" $_fishprompt_aid
end
function fish_prompt
set _fishprompt_disp_count (math $_fishprompt_disp_count + 1)
printf "\033]133;P;k=i\007%b\033]133;B\007" (string join "\n" (_fishprompt_saved_prompt))
set _fishprompt_started 1
set _fishprompt_postexec ""
end
function _fishprompt_preexec --on-event fish_preexec
if [ "$_fishprompt_started" = 1 ]
printf "\033]133;C;\007"
end
set _fishprompt_started 0
end
function _fishprompt_postexec --on-event fish_postexec
set _fishprompt_postexec $status
_fishprompt_start
end
function __fishprompt_cancel --on-event fish_cancel
set _fishprompt_postexec CANCEL
_fishprompt_start
end
function _fishprompt_exit --on-process %self
if [ "$_fishprompt_started" = 1 ]
printf "\033]133;Z;aid=%s\007" $_fishprompt_aid
end
end
if functions -q fish_right_prompt
functions -c fish_right_prompt _fishprompt_saved_right_prompt
function fish_right_prompt
printf "\033]133;P;k=r\007%b\033]133;B\007" (string join "\n" (_fishprompt_saved_right_prompt))
end
end
end

View file

@ -3,9 +3,10 @@
add_newline = true add_newline = true
format = """\ format = """\
${custom.pwd}\
$fill\ $fill\
${custom.pwd}\
$line_break\ $line_break\
$hostname\
$directory\ $directory\
($character)\ ($character)\
""" """
@ -13,43 +14,41 @@ $directory\
right_format = """\ right_format = """\
$cmd_duration\ $cmd_duration\
$git_branch$git_commit$git_status$git_state\ $git_branch$git_commit$git_status$git_state\
$hostname\
""" """
[hostname] [hostname]
ssh_only = false ssh_only = false
format = " [](fg:#222222)[ $hostname ](italic dimmed bg:#222222 fg:#999999)" format = "[$hostname](italic bold)"
disabled = false disabled = false
[time] [time]
disabled = false disabled = false
format = ' [$time]($style)' format = '[ $time](italic dimmed inverted)'
style = "italic dimmed fg:#666666"
time_format = '%R' time_format = '%R'
[custom.pwd] [custom.pwd]
command = "pwd" command = "prompt_pwd -D 100"
when = true when = true
format = "[($output)]($style) " format = "[ $output]($style)"
style = "italic dimmed fg:#777777" style = "italic dimmed"
[directory] [directory]
fish_style_pwd_dir_length = 1 fish_style_pwd_dir_length = 1
truncation_length = 1 truncation_length = 1
truncate_to_repo = false truncate_to_repo = false
truncation_symbol = "…" truncation_symbol = "…"
style = "italic fg:#88aabb" style = "italic"
[line_break] [line_break]
disabled = false disabled = false
[fill] [fill]
symbol = '' symbol = ''
style = 'fg:#333333' style = 'dimmed fg:#888888'
[character] [character]
success_symbol = "[%](bold fg:#66cc99)" success_symbol = "[%](bold)"
error_symbol = "[%](bold red)" error_symbol = "[](bold red)"
[cmd_duration] [cmd_duration]
min_time = 500 min_time = 500
@ -57,14 +56,14 @@ format = '[󱦟 $duration ](yellow)'
[git_branch] [git_branch]
format = "[$symbol$branch]($style)" format = "[$symbol$branch]($style)"
style = "italic bold fg:#00ac73" style = "italic bold green"
symbol = " " symbol = " "
truncation_length = 16 truncation_length = 16
truncation_symbol = "" truncation_symbol = ""
[git_commit] [git_commit]
format = "[ $hash$tag]($style) " format = "[ $hash$tag]($style) "
style = "fg:#00d992" style = "cyan"
[git_state] [git_state]
style = "" style = ""
@ -72,7 +71,7 @@ style = ""
[git_status] [git_status]
format = '([$all_status$ahead_behind]($style))' format = '([$all_status$ahead_behind]($style))'
style = "fg:#00ac73" style = "fg:#00ac73"
modified = "[ 󰦒](fg:#d1c000)" modified = "[ 󰦒](yellow)"
deleted = "[ ✘](fg:#b93400)" deleted = "[ ✘](red)"
untracked = "[ ?](fg:#9c49aa)" untracked = "[ ?](purple)"
staged = "[ 󰐖](fg:#71a4aa)" staged = "[ 󰐖](cyan)"