diff options
| author | coasteen <coasteen@proton.me> | 2026-07-09 10:42:28 +0330 |
|---|---|---|
| committer | coasteen <coasteen@proton.me> | 2026-07-09 10:42:28 +0330 |
| commit | 8cbadb61604667b407b53ee1258433994fa4765a (patch) | |
| tree | 97765fb29418fd6278fcb4cbb9760893afaf7a58 /config/nushell | |
Diffstat (limited to 'config/nushell')
| -rwxr-xr-x | config/nushell/config.nu | 99 | ||||
| -rwxr-xr-x | config/nushell/starship.nu | 35 |
2 files changed, 134 insertions, 0 deletions
diff --git a/config/nushell/config.nu b/config/nushell/config.nu new file mode 100755 index 0000000..1658d14 --- /dev/null +++ b/config/nushell/config.nu @@ -0,0 +1,99 @@ +$env.config.buffer_editor = "vim" +$env.PROMPT_COMMAND_RIGHT = "" +$env.path ++= ["~/.local/bin"] +$env.config.show_banner = false +$env.config.table.mode = 'none' +$env.TERM = "xterm" +$env.USER = "coast" + +$env.PROMPT_COMMAND = { + let dir = (pwd | path basename) + let home_dir = ($dir | str replace "coast" "home") + $"(ansi reset)0 ($env.USER) ($home_dir) " +} + +$env.PROMPT_INDICATOR = "" + +let carapace_completer = {|spans| + carapace $spans.0 nushell ...$spans | from json +} + +$env.config = { + show_banner: false + completions: { + case_sensitive: false + quick: true + partial: true + algorithm: "fuzzy" + external: { + enable: true + max_results: 100 + completer: $carapace_completer + } + } +} + +alias sd = sudo +alias nano = vim +alias suod = sudo +alias sduo = sudo +alias hotp = htop +alias c = clear +alias dir = tree -idA + +let bg0 = "#0f0f0f" +let bg1 = "#1a1a1a" +let bg2 = "#2a2a2a" +let bg3 = "#3a3a3a" +let fg0 = "#e0def4" +let fg1 = "#ebbcba" +let red = "#eb6f92" +let green = "#eb6f92" +let yellow = "#ea9a97" +let blue = "#d7827e" +let purple = "#ea9a97" +let aqua = "#ebbcba" +let orange = "#ea9a97" +let gray = "#6e6a86" + +let dark = { + separator: $gray, + leading_trailing_space_bg: $bg1, + header: $yellow, + datetime: $blue, + filesize: $green, + row_index: $gray, + + bool: $green, + int: $orange, + float: $yellow, + string: $fg1, + nothing: $gray, + binary: $red, + cell-path: $blue, + hints: $gray, + + shape_garbage: { fg: $fg0 bg: $red attr: b }, + shape_bool: $green, + shape_int: { fg: $orange attr: b }, + shape_float: { fg: $yellow attr: b }, + shape_range: { fg: $yellow attr: b }, + shape_internalcall: { fg: $aqua attr: b }, + shape_external: $blue, + shape_externalarg: { fg: $green attr: b }, + shape_literal: $fg1, + shape_operator: $orange, + shape_signature: { fg: $yellow attr: b }, + shape_string: $purple, + shape_filepath: $blue, + shape_globpattern: { fg: $blue attr: b }, + shape_variable: $aqua, + shape_flag: { fg: $yellow attr: b }, + shape_custom: { attr: b } +} + +$env.config.color_config = $dark +$env.config.use_ansi_coloring = true + +source ~/.config/nushell/starship.nu + diff --git a/config/nushell/starship.nu b/config/nushell/starship.nu new file mode 100755 index 0000000..8bef494 --- /dev/null +++ b/config/nushell/starship.nu @@ -0,0 +1,35 @@ +export-env { $env.STARSHIP_SHELL = "nu"; load-env { + STARSHIP_SESSION_KEY: (random chars -l 16) + PROMPT_MULTILINE_INDICATOR: ( + ^/etc/profiles/per-user/coast/bin/starship prompt --continuation + ) + + # Does not play well with default character module. + # TODO: Also Use starship vi mode indicators? + PROMPT_INDICATOR: "" + + PROMPT_COMMAND: {|| + # jobs are not supported + ( + ^/etc/profiles/per-user/coast/bin/starship prompt + --cmd-duration $env.CMD_DURATION_MS + $"--status=($env.LAST_EXIT_CODE)" + --terminal-width (term size).columns + ) + } + + config: ($env.config? | default {} | merge { + render_right_prompt_on_last_line: true + }) + + PROMPT_COMMAND_RIGHT: {|| + ( + ^/etc/profiles/per-user/coast/bin/starship prompt + --right + --cmd-duration $env.CMD_DURATION_MS + $"--status=($env.LAST_EXIT_CODE)" + --terminal-width (term size).columns + ) + } +}} + |
