Improved nushell config

This commit is contained in:
Eduard Urbach 2023-07-17 14:05:11 +02:00
parent 6fc76fe594
commit df3d1ef735
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
2 changed files with 30 additions and 48 deletions

View File

@ -552,8 +552,10 @@ let-env config = {
]
}
# Custom configuration
# Set editor
let-env EDITOR = 'nvim'
# Aliases
alias ll = ls -l
alias gb = go build
alias gt = go test

View File

@ -24,29 +24,9 @@ def create_left_prompt [] {
$path_segment | str replace --all --string (char path_sep) $"($separator_color)/($path_color)"
}
def create_right_prompt [] {
let time_segment_color = (ansi magenta)
let time_segment = ([
(ansi reset)
$time_segment_color
(date now | date format '%m/%d/%Y %r')
] | str join | str replace --all "([/:])" $"(ansi light_magenta_bold)${1}($time_segment_color)" |
str replace --all "([AP]M)" $"(ansi light_magenta_underline)${1}")
let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([
(ansi rb)
($env.LAST_EXIT_CODE)
] | str join)
} else { "" }
([$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 prompt
let-env PROMPT_COMMAND = {|| create_left_prompt }
let-env PROMPT_COMMAND_RIGHT = ""
#let-env PROMPT_COMMAND_RIGHT = {|| create_right_prompt }
# The prompt indicators are environmental variables that represent
# the state of the prompt