2023-06-28 20:48:01 +00:00
|
|
|
# Nushell Environment Config File
|
|
|
|
|
|
|
|
def create_left_prompt [] {
|
|
|
|
let path_segment = if (is-admin) {
|
|
|
|
$"(ansi red_bold)($env.PWD)"
|
|
|
|
} else {
|
|
|
|
$"(ansi green_bold)($env.PWD)"
|
|
|
|
}
|
|
|
|
|
|
|
|
$path_segment
|
|
|
|
}
|
|
|
|
|
|
|
|
def create_right_prompt [] {
|
|
|
|
let time_segment = ([
|
2023-12-22 19:48:33 +00:00
|
|
|
(date now | format date '%m/%d/%Y %r')
|
2023-06-28 20:48:01 +00:00
|
|
|
] | str join)
|
|
|
|
|
|
|
|
$time_segment
|
|
|
|
}
|
|
|
|
|
|
|
|
# Use nushell functions to define your right and left prompt
|
2023-08-12 00:48:14 +00:00
|
|
|
$env.PROMPT_COMMAND = { create_left_prompt }
|
|
|
|
$env.PROMPT_COMMAND_RIGHT = { create_right_prompt }
|
2023-06-28 20:48:01 +00:00
|
|
|
|
|
|
|
# The prompt indicators are environmental variables that represent
|
|
|
|
# the state of the prompt
|
2023-08-12 00:48:14 +00:00
|
|
|
$env.PROMPT_INDICATOR = { "〉" }
|
|
|
|
$env.PROMPT_INDICATOR_VI_INSERT = { ": " }
|
|
|
|
$env.PROMPT_INDICATOR_VI_NORMAL = { "〉" }
|
|
|
|
$env.PROMPT_MULTILINE_INDICATOR = { "::: " }
|
2023-06-28 20:48:01 +00:00
|
|
|
|
|
|
|
# Specifies how environment variables are:
|
|
|
|
# - converted from a string to a value on Nushell startup (from_string)
|
|
|
|
# - converted from a value back to a string when running external commands (to_string)
|
|
|
|
# Note: The conversions happen *after* config.nu is loaded
|
2023-08-12 00:48:14 +00:00
|
|
|
$env.ENV_CONVERSIONS = {
|
2023-06-28 20:48:01 +00:00
|
|
|
"PATH": {
|
|
|
|
from_string: { |s| $s | split row (char esep) | path expand -n }
|
|
|
|
to_string: { |v| $v | path expand -n | str join (char esep) }
|
|
|
|
}
|
|
|
|
"Path": {
|
|
|
|
from_string: { |s| $s | split row (char esep) | path expand -n }
|
|
|
|
to_string: { |v| $v | path expand -n | str join (char esep) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Directories to search for scripts when calling source or use
|
|
|
|
#
|
|
|
|
# By default, <nushell-config-dir>/scripts is added
|
2023-08-12 00:48:14 +00:00
|
|
|
$env.NU_LIB_DIRS = [
|
2023-06-28 20:48:01 +00:00
|
|
|
($nu.config-path | path dirname | path join 'scripts')
|
|
|
|
]
|
|
|
|
|
|
|
|
# Directories to search for plugin binaries when calling register
|
|
|
|
#
|
|
|
|
# By default, <nushell-config-dir>/plugins is added
|
2023-08-12 00:48:14 +00:00
|
|
|
$env.NU_PLUGIN_DIRS = [
|
2023-06-28 20:48:01 +00:00
|
|
|
($nu.config-path | path dirname | path join 'plugins')
|
|
|
|
]
|
|
|
|
|
|
|
|
# To add entries to PATH (on Windows you might use Path), you can use the following pattern:
|
2023-08-12 00:48:14 +00:00
|
|
|
# $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path')
|