fix: fix nushell expressions, implement starship workaround

This commit is contained in:
notohh 2023-04-09 17:58:21 -04:00
parent 25849fe244
commit 870ed093e8
Signed by: notohh
GPG key ID: BD47506D475EE86D
3 changed files with 14 additions and 10 deletions

View file

@ -303,10 +303,10 @@ let-env config = {
show_banner: false # true or false to enable or disable the banner show_banner: false # true or false to enable or disable the banner
render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt. render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt.
hooks: { hooks: {
pre_prompt: [{ pre_prompt: [{ ||
$nothing # replace with source code to run before the prompt is shown $nothing # replace with source code to run before the prompt is shown
}] }]
pre_execution: [{ pre_execution: [{ ||
$nothing # replace with source code to run before the repl input is run $nothing # replace with source code to run before the repl input is run
}] }]
env_change: { env_change: {
@ -314,7 +314,7 @@ let-env config = {
$nothing # replace with source code to run if the PWD environment is different since the last repl input $nothing # replace with source code to run if the PWD environment is different since the last repl input
}] }]
} }
display_output: { display_output: { ||
if (term size).columns >= 100 { table -e } else { table } if (term size).columns >= 100 { table -e } else { table }
} }
} }

View file

@ -19,15 +19,15 @@ def create_right_prompt [] {
} }
# Use nushell functions to define your right and left prompt # Use nushell functions to define your right and left prompt
let-env PROMPT_COMMAND = { create_left_prompt } let-env PROMPT_COMMAND = {|| create_left_prompt }
let-env PROMPT_COMMAND_RIGHT = { create_right_prompt } let-env PROMPT_COMMAND_RIGHT = {|| create_right_prompt }
# The prompt indicators are environmental variables that represent # The prompt indicators are environmental variables that represent
# the state of the prompt # the state of the prompt
let-env PROMPT_INDICATOR = { "〉" } let-env PROMPT_INDICATOR = {|| "〉" }
let-env PROMPT_INDICATOR_VI_INSERT = { ": " } let-env PROMPT_INDICATOR_VI_INSERT = {|| ": " }
let-env PROMPT_INDICATOR_VI_NORMAL = { "〉" } let-env PROMPT_INDICATOR_VI_NORMAL = {|| "〉" }
let-env PROMPT_MULTILINE_INDICATOR = { "::: " } let-env PROMPT_MULTILINE_INDICATOR = {|| "::: " }
# Specifies how environment variables are: # Specifies how environment variables are:
# - converted from a string to a value on Nushell startup (from_string) # - converted from a string to a value on Nushell startup (from_string)
@ -59,3 +59,7 @@ let-env NU_PLUGIN_DIRS = [
] ]
# To add entries to PATH (on Windows you might use Path), you can use the following pattern: # To add entries to PATH (on Windows you might use Path), you can use the following pattern:
# let-env PATH = ($env.PATH | split row (char esep) | prepend '/some/path') # let-env PATH = ($env.PATH | split row (char esep) | prepend '/some/path')
starship init nu
| str replace --string 'PROMPT_COMMAND = {' 'PROMPT_COMMAND = { ||'
| str replace --string 'PROMPT_COMMAND_RIGHT = {' 'PROMPT_COMMAND_RIGHT = { ||'
| save -f ~/.cache/starship/init.nu

View file

@ -7,7 +7,7 @@
programs.starship = { programs.starship = {
enable = true; enable = true;
enableNushellIntegration = true; enableNushellIntegration = false; #integration broken since nushell 0.78
settings = { settings = {
format = lib.concatStrings [ format = lib.concatStrings [
"[](#f5c2e7)" "[](#f5c2e7)"