nushell: color mods

unique color for user/hostname + fixed external command color
This commit is contained in:
dogeystamp 2024-08-04 15:55:57 -04:00
parent 5973641c21
commit f523507e7a
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
2 changed files with 16 additions and 6 deletions

View File

@ -23,6 +23,10 @@ alias xxd = tinyxxd
$env.config = {
show_banner: false
color_config: {
shape_external_resolved: { fg: "grey", attr: "b" }
}
ls: {
use_ls_colors: true # use the LS_COLORS environment variable to colorize output
clickable_links: true # enable or disable clickable links. Your terminal has to support links.

View File

@ -6,16 +6,22 @@ def create_left_prompt [] {
let user_color = ansi grey
let path_color = ansi cyan
let separator_color = ansi grey
let status_color = ansi dark_gray
let status_color = ansi dark_gray
let uniq_color = [(whoami), (sys host).hostname] | str join
| hash md5
| str substring 0..5
| ansi {fg: $'#($in)'}
let host = (sys host).hostname | str substring ..2
let user = whoami | str substring ..4
let userstr = $'($user_color)($user)@($host) '
let uniq_indicator = $'($user_color)[($uniq_color)○($user_color)] '
let host = (sys host).hostname | str substring ..2
let user = whoami | str substring ..4
let userstr = $'($user_color)($user)@($host) '
let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([
$status_color
$env.LAST_EXIT_CODE
" "
" "
] | str join)
} else { "" }
@ -27,7 +33,7 @@ def create_left_prompt [] {
}
let path_segment = $"($path_color)($dir)"
[$last_exit_code $userstr ($path_segment | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)")] | str join
[$uniq_indicator $userstr $last_exit_code $path_segment] | str join
}
# Use nushell functions to define your right and left prompt