From 870ed093e8da763e2cd505436cd025cb41d0690d Mon Sep 17 00:00:00 2001 From: notohh Date: Sun, 9 Apr 2023 17:58:21 -0400 Subject: [PATCH] fix: fix nushell expressions, implement starship workaround --- home/nushell/config.nu | 6 +++--- home/nushell/env.nu | 16 ++++++++++------ home/starship/default.nix | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/home/nushell/config.nu b/home/nushell/config.nu index 2e721f0..89681a4 100755 --- a/home/nushell/config.nu +++ b/home/nushell/config.nu @@ -303,10 +303,10 @@ let-env config = { 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. hooks: { - pre_prompt: [{ + pre_prompt: [{ || $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 }] 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 }] } - display_output: { + display_output: { || if (term size).columns >= 100 { table -e } else { table } } } diff --git a/home/nushell/env.nu b/home/nushell/env.nu index 583b7c9..e71c39b 100755 --- a/home/nushell/env.nu +++ b/home/nushell/env.nu @@ -19,15 +19,15 @@ def create_right_prompt [] { } # Use nushell functions to define your right and left prompt -let-env PROMPT_COMMAND = { create_left_prompt } -let-env PROMPT_COMMAND_RIGHT = { create_right_prompt } +let-env PROMPT_COMMAND = {|| create_left_prompt } +let-env PROMPT_COMMAND_RIGHT = {|| create_right_prompt } # The prompt indicators are environmental variables that represent # the state of the prompt -let-env PROMPT_INDICATOR = { "〉" } -let-env PROMPT_INDICATOR_VI_INSERT = { ": " } -let-env PROMPT_INDICATOR_VI_NORMAL = { "〉" } -let-env PROMPT_MULTILINE_INDICATOR = { "::: " } +let-env PROMPT_INDICATOR = {|| "〉" } +let-env PROMPT_INDICATOR_VI_INSERT = {|| ": " } +let-env PROMPT_INDICATOR_VI_NORMAL = {|| "〉" } +let-env PROMPT_MULTILINE_INDICATOR = {|| "::: " } # Specifies how environment variables are: # - 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: # 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 \ No newline at end of file diff --git a/home/starship/default.nix b/home/starship/default.nix index 7469df7..4286da5 100644 --- a/home/starship/default.nix +++ b/home/starship/default.nix @@ -7,7 +7,7 @@ programs.starship = { enable = true; - enableNushellIntegration = true; + enableNushellIntegration = false; #integration broken since nushell 0.78 settings = { format = lib.concatStrings [ "[░▒▓](#f5c2e7)"