config dump

This commit is contained in:
Bloxx12 2025-07-17 00:55:24 +02:00
commit cf8afe544a
Signed by: faukah
SSH key fingerprint: SHA256:Uj2AXqvtdCA4hn5Hq0ZonhIAyUqI1q4w2sMG3Z1TH7E
6 changed files with 355 additions and 357 deletions

View file

@ -1,55 +1,57 @@
use std null_device
export-env { load-env {
PROMPT_COMMAND: {||
let exit_code = $env.LAST_EXIT_CODE
let jj_root = try { ^jj root err> $null_device } catch { "" }
$env.LAST_EXIT_CODE = 0
let vcs_root = if not ($jj_root | is-empty ) { $jj_root } else {""}
mut path_segment = ""
if not (($vcs_root | is-empty) or ($env.PWD == $vcs_root)) {
# vcs_root is not empty, we're not in the vcs_root of the project
$path_segment = [($vcs_root | path basename), ($env.PWD | path basename)] | str join " @ "
} else {
$path_segment = $env.PWD | path basename
}
let exit_code_segment = if ($exit_code == 0) {
""
} else {
$"(ansi yellow)━┫(ansi red)($exit_code)(ansi yellow)┣━"
}
export-env {
load-env {
PROMPT_COMMAND: {||
let exit_code = $env.LAST_EXIT_CODE
let jj_root = try { ^jj root err> $null_device } catch { "" }
$env.LAST_EXIT_CODE = 0
let vcs_root = if not ($jj_root | is-empty) { $jj_root } else { "" }
[$"(ansi yellow)┏",$exit_code_segment,"━ ", $path_segment, "\n"] | str join
mut path_segment = ""
if not (($vcs_root | is-empty) or ($env.PWD == $vcs_root)) {
# vcs_root is not empty, we're not in the vcs_root of the project
$path_segment = [($vcs_root | path basename) ($env.PWD | path basename)] | str join " @ "
} else {
$path_segment = $env.PWD | path basename
}
}
TRANSIENT_PROMPT_COMMAND: {||
let path_segment = $env.PWD | path basename
let exit_code_segment = if ($env.LAST_EXIT_CODE == 0) {
""
} else {
$"(ansi yellow)━┫(ansi red)($env.LAST_EXIT_CODE)(ansi yellow)┣━"
}
let exit_code_segment = if ($exit_code == 0) {
""
} else {
$"(ansi yellow)━┫(ansi red)($exit_code)(ansi yellow)┣━"
}
[$"(ansi yellow)━",$exit_code_segment,"━ ", $path_segment] | str join
}
PROMPT_INDICATOR_VI_INSERT: $"(ansi yellow)┃ "
PROMPT_INDICATOR_VI_NORMAL: $"(ansi yellow)┋ "
# PROMPT_MULTILINE_INDICATOR: "::: "
PROMPT_MULTILINE_INDICATOR: $"(ansi yellow)┃ "
TRANSIENT_PROMPT_INDICATOR_VI_INSERT: " "
TRANSIENT_PROMPT_INDICATOR_VI_NORMAL: " "
TRANSIENT_PROMPT_MULTILINE_INDICATOR: $"(ansi yellow)┃ "
[$"(ansi yellow)┏" $exit_code_segment "━ " $path_segment "\n"] | str join
}
TRANSIENT_PROMPT_COMMAND: {||
let path_segment = $env.PWD | path basename
config: ($env.config? | default {} | merge {
render_right_prompt_on_last_line: true
})
let exit_code_segment = if ($env.LAST_EXIT_CODE == 0) {
""
} else {
$"(ansi yellow)━┫(ansi red)($env.LAST_EXIT_CODE)(ansi yellow)┣━"
}
PROMPT_COMMAND_RIGHT: {||
let jj_status = try {
jj --quiet --color always --ignore-working-copy log --no-graph --revisions @ --template '
[$"(ansi yellow)━" $exit_code_segment "━ " $path_segment] | str join
}
PROMPT_INDICATOR_VI_INSERT: $"(ansi yellow)┃ "
PROMPT_INDICATOR_VI_NORMAL: $"(ansi yellow)┋ "
# PROMPT_MULTILINE_INDICATOR: "::: "
PROMPT_MULTILINE_INDICATOR: $"(ansi yellow)┃ "
TRANSIENT_PROMPT_INDICATOR_VI_INSERT: " "
TRANSIENT_PROMPT_INDICATOR_VI_NORMAL: " "
TRANSIENT_PROMPT_MULTILINE_INDICATOR: $"(ansi yellow)┃ "
config: (
$env.config? | default {} | merge {
render_right_prompt_on_last_line: true
}
)
PROMPT_COMMAND_RIGHT: {||
let jj_status = try {
jj --quiet --color always --ignore-working-copy log --no-graph --revisions @ --template '
separate(
" ",
if(empty, label("empty", "(empty)")),
@ -73,8 +75,10 @@ PROMPT_COMMAND_RIGHT: {||
if(hidden, label("hidden prefix", "(hidden)")),
)
' err> $null_device
} catch {
""
} catch {
""
}
$jj_status
}
}
$jj_status
}}}
}