nushell: Small fixes
This commit is contained in:
@ -30,6 +30,13 @@ source theme.nu
|
|||||||
$env.config = {
|
$env.config = {
|
||||||
show_banner: false
|
show_banner: false
|
||||||
|
|
||||||
|
display_errors: {
|
||||||
|
exit_code: false # assume the external command prints an error message
|
||||||
|
# Core dump errors are always printed, and SIGPIPE never triggers an error.
|
||||||
|
# The setting below controls message printing for termination by all other signals.
|
||||||
|
termination_signal: true
|
||||||
|
}
|
||||||
|
|
||||||
ls: {
|
ls: {
|
||||||
use_ls_colors: true # use the LS_COLORS environment variable to colorize output
|
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.
|
clickable_links: true # enable or disable clickable links. Your terminal has to support links.
|
||||||
|
|||||||
@ -3,43 +3,43 @@
|
|||||||
# version = 0.83.1
|
# version = 0.83.1
|
||||||
|
|
||||||
def create_left_prompt [] {
|
def create_left_prompt [] {
|
||||||
mut home = ""
|
mut home = ""
|
||||||
try {
|
try {
|
||||||
if $nu.os-info.name == "windows" {
|
if $nu.os-info.name == "windows" {
|
||||||
$home = $env.USERPROFILE
|
$home = $env.USERPROFILE
|
||||||
} else {
|
} else {
|
||||||
$home = $env.HOME
|
$home = $env.HOME
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let dir = ([
|
let dir = ([
|
||||||
($env.PWD | str substring 0..($home | str length) | str replace $home "~"),
|
($env.PWD | str substring 0..($home | str length) | str replace $home "~"),
|
||||||
($env.PWD | str substring ($home | str length)..)
|
($env.PWD | str substring ($home | str length)..)
|
||||||
] | str join)
|
] | str join)
|
||||||
|
|
||||||
let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold })
|
let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold })
|
||||||
let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold })
|
let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold })
|
||||||
let path_segment = $"($path_color)($dir)"
|
let path_segment = $"($path_color)($dir)"
|
||||||
|
|
||||||
$path_segment | str replace --all (char path_sep) $"($separator_color)/($path_color)"
|
$path_segment | str replace --all (char path_sep) $"($separator_color)/($path_color)"
|
||||||
}
|
}
|
||||||
|
|
||||||
def create_right_prompt [] {
|
def create_right_prompt [] {
|
||||||
# create a right prompt in magenta with green separators and am/pm underlined
|
# create a right prompt in magenta with green separators and am/pm underlined
|
||||||
let time_segment = ([
|
let time_segment = ([
|
||||||
(ansi reset)
|
(ansi reset)
|
||||||
(ansi magenta)
|
(ansi magenta)
|
||||||
(date now | date format '%Y/%m/%d %r')
|
(date now | date format '%Y/%m/%d %r')
|
||||||
] | str join | str replace --all "([/:])" $"(ansi green)${1}(ansi magenta)" |
|
] | str join | str replace --all "([/:])" $"(ansi green)${1}(ansi magenta)" |
|
||||||
str replace --all "([AP]M)" $"(ansi magenta_underline)${1}")
|
str replace --all "([AP]M)" $"(ansi magenta_underline)${1}")
|
||||||
|
|
||||||
let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([
|
let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([
|
||||||
(ansi rb)
|
(ansi rb)
|
||||||
($env.LAST_EXIT_CODE)
|
($env.LAST_EXIT_CODE)
|
||||||
] | str join)
|
] | str join)
|
||||||
} else { "" }
|
} else { "" }
|
||||||
|
|
||||||
([$last_exit_code, (char space), $time_segment] | str join)
|
([$last_exit_code, (char space), $time_segment] | str join)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use nushell functions to define your right and left prompt
|
# Use nushell functions to define your right and left prompt
|
||||||
@ -58,31 +58,35 @@ $env.PROMPT_MULTILINE_INDICATOR = {|| "::: " }
|
|||||||
# - converted from a value back to a string when running external commands (to_string)
|
# - converted from a value back to a string when running external commands (to_string)
|
||||||
# Note: The conversions happen *after* config.nu is loaded
|
# Note: The conversions happen *after* config.nu is loaded
|
||||||
$env.ENV_CONVERSIONS = {
|
$env.ENV_CONVERSIONS = {
|
||||||
"PATH": {
|
"PATH": {
|
||||||
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
|
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
|
||||||
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
|
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
|
||||||
}
|
}
|
||||||
"Path": {
|
"Path": {
|
||||||
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
|
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
|
||||||
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
|
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Directories to search for scripts when calling source or use
|
# Directories to search for scripts when calling source or use
|
||||||
$env.NU_LIB_DIRS = [
|
$env.NU_LIB_DIRS = [
|
||||||
# ($nu.default-config-dir | path join 'scripts') # add <nushell-config-dir>/scripts
|
# ($nu.default-config-dir | path join 'scripts') # add <nushell-config-dir>/scripts
|
||||||
]
|
]
|
||||||
|
|
||||||
# Directories to search for plugin binaries when calling register
|
# Directories to search for plugin binaries when calling register
|
||||||
$env.NU_PLUGIN_DIRS = [
|
$env.NU_PLUGIN_DIRS = [
|
||||||
# ($nu.default-config-dir | path join 'plugins') # add <nushell-config-dir>/plugins
|
# ($nu.default-config-dir | path join 'plugins') # add <nushell-config-dir>/plugins
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if XDG_CONFIG_HOME not-in $env {
|
||||||
|
$env.XDG_CONFIG_HOME = $"($env.HOME)/.config"
|
||||||
|
}
|
||||||
|
|
||||||
$env.PATH = ($env.PATH | split row (char esep) | prepend [
|
$env.PATH = ($env.PATH | split row (char esep) | prepend [
|
||||||
($env.HOME + "/.local/bin"),
|
($env.HOME + "/.local/bin"),
|
||||||
($env.HOME + "/.cargo/bin"),
|
($env.HOME + "/.cargo/bin"),
|
||||||
($env.HOME + "/.radicle/bin"),
|
($env.HOME + "/.radicle/bin"),
|
||||||
($env.HOME + "/.volta/bin"),
|
($env.HOME + "/.volta/bin"),
|
||||||
])
|
])
|
||||||
|
|
||||||
# auto-detect which ssh-agent to use
|
# auto-detect which ssh-agent to use
|
||||||
|
|||||||
Reference in New Issue
Block a user