1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-30 11:37:44 +00:00

Nu: Cleanup Nu configs

This commit is contained in:
RGBCube 2023-05-03 13:22:03 +03:00
parent 714737a229
commit 370b189b32
2 changed files with 113 additions and 48 deletions

View file

@ -1,13 +1,16 @@
let theme = { let theme = {
filesize: {|e| filesize: { |size|
if $e == 0b { if $size == 0b {
'white' 'white'
} else if $e < 1mb { } else if $size < 1mb {
'cyan' 'cyan'
} else { 'blue' } } else {
'blue'
}
} }
date: {|| (date now) - $in | date: { ||
(date now) - $in |
if $in < 1hr { if $in < 1hr {
'red3b' 'red3b'
} else if $in < 6hr { } else if $in < 6hr {
@ -22,7 +25,9 @@ let theme = {
'darkturquoise' 'darkturquoise'
} else if $in < 52wk { } else if $in < 52wk {
'deepskyblue3b' 'deepskyblue3b'
} else { 'dark_gray' } } else {
'dark_gray'
}
} }
bool: { || bool: { ||
@ -33,7 +38,9 @@ let theme = {
} }
} }
leading_trailing_space_bg: { attr: n } leading_trailing_space_bg: {
attr: n
}
empty: blue empty: blue
hints: dark_gray hints: dark_gray
@ -52,8 +59,16 @@ let theme = {
list: white list: white
block: white block: white
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b} shape_garbage: {
shape_matching_brackets: { attr: u } fg: "#FFFFFF"
bg: "#FF0000"
attr: b
}
shape_matching_brackets: {
attr: u
}
shape_and: purple_bold shape_and: purple_bold
shape_binary: purple_bold shape_binary: purple_bold
shape_block: blue_bold shape_block: blue_bold
@ -107,6 +122,7 @@ let-env config = {
mode: rounded mode: rounded
index_mode: always index_mode: always
show_empty: true show_empty: true
trim: { trim: {
methodology: wrapping methodology: wrapping
wrapping_try_keep_words: true wrapping_try_keep_words: true
@ -118,8 +134,16 @@ let-env config = {
help_banner: true help_banner: true
exit_esc: true exit_esc: true
command_bar_text: '#C4C9C6' command_bar_text: '#C4C9C6'
status_bar_background: {fg: '#1D1F21' bg: '#C4C9C6' }
highlight: {bg: 'yellow' fg: 'black' } status_bar_background: {
fg: '#1D1F21'
bg: '#C4C9C6'
}
highlight: {
bg: 'yellow'
fg: 'black'
}
table: { table: {
split_line: '#404040' split_line: '#404040'
@ -133,12 +157,15 @@ let-env config = {
} }
config: { config: {
cursor_color: {bg: 'yellow' fg: 'black' } cursor_color: {
bg: 'yellow'
fg: 'black'
}
} }
} }
history: { history: {
max_size: 10000 max_size: 1000
sync_on_enter: true sync_on_enter: true
file_format: "plaintext" file_format: "plaintext"
} }
@ -147,7 +174,8 @@ let-env config = {
case_sensitive: false case_sensitive: false
quick: true quick: true
partial: true partial: true
algorithm: "prefix" algorithm: "fuzzy"
external: { external: {
enable: true enable: true
max_results: 100 max_results: 100
@ -172,11 +200,15 @@ let-env config = {
use_ansi_coloring: true use_ansi_coloring: true
edit_mode: vi edit_mode: vi
shell_integration: false shell_integration: false
render_right_prompt_on_last_line: false render_right_prompt_on_last_line: true
hooks: { hooks: {
display_output: { || display_output: { ||
if (term size).columns >= 100 { table -e } else { table } if (term size).columns >= 100 {
table -e
} else {
table
}
} }
} }
@ -185,12 +217,14 @@ let-env config = {
name: completion_menu name: completion_menu
only_buffer_difference: false only_buffer_difference: false
marker: "| " marker: "| "
type: { type: {
layout: columnar layout: columnar
columns: 4 columns: 4
col_width: 20 col_width: 20
col_padding: 2 col_padding: 2
} }
style: { style: {
text: green text: green
selected_text: green_reverse selected_text: green_reverse
@ -201,10 +235,12 @@ let-env config = {
name: history_menu name: history_menu
only_buffer_difference: true only_buffer_difference: true
marker: "? " marker: "? "
type: { type: {
layout: list layout: list
page_size: 10 page_size: 10
} }
style: { style: {
text: green text: green
selected_text: green_reverse selected_text: green_reverse
@ -215,6 +251,7 @@ let-env config = {
name: help_menu name: help_menu
only_buffer_difference: true only_buffer_difference: true
marker: "? " marker: "? "
type: { type: {
layout: description layout: description
columns: 4 columns: 4
@ -223,6 +260,7 @@ let-env config = {
selection_rows: 4 selection_rows: 4
description_rows: 10 description_rows: 10
} }
style: { style: {
text: green text: green
selected_text: green_reverse selected_text: green_reverse
@ -233,47 +271,60 @@ let-env config = {
name: commands_menu name: commands_menu
only_buffer_difference: false only_buffer_difference: false
marker: "# " marker: "# "
type: { type: {
layout: columnar layout: columnar
columns: 4 columns: 4
col_width: 20 col_width: 20
col_padding: 2 col_padding: 2
} }
style: { style: {
text: green text: green
selected_text: green_reverse selected_text: green_reverse
description_text: yellow description_text: yellow
} }
source: { |buffer, position| source: { |buffer, position|
$nu.scope.commands $nu.scope.commands
| where name =~ $buffer | where name =~ $buffer
| each { |it| {value: $it.name description: $it.usage} } | each { |it| {
value: $it.name
description: $it.usage
} }
} }
} }
{ {
name: vars_menu name: vars_menu
only_buffer_difference: true only_buffer_difference: true
marker: "# " marker: "# "
type: { type: {
layout: list layout: list
page_size: 10 page_size: 10
} }
style: { style: {
text: green text: green
selected_text: green_reverse selected_text: green_reverse
description_text: yellow description_text: yellow
} }
source: { |buffer, position| source: { |buffer, position|
nu.scope.vars nu.scope.vars
| where name =~ $buffer | where name =~ $buffer
| sort-by name | sort-by name
| each { |it| {value: $it.name description: $it.type} } | each { |it| {
value: $it.name
description: $it.type
} }
} }
} }
{ {
name: commands_with_description name: commands_with_description
only_buffer_difference: true only_buffer_difference: true
marker: "# " marker: "# "
type: { type: {
layout: description layout: description
columns: 4 columns: 4
@ -282,15 +333,20 @@ let-env config = {
selection_rows: 4 selection_rows: 4
description_rows: 10 description_rows: 10
} }
style: { style: {
text: green text: green
selected_text: green_reverse selected_text: green_reverse
description_text: yellow description_text: yellow
} }
source: { |buffer, position| source: { |buffer, position|
$nu.scope.commands $nu.scope.commands
| where name =~ $buffer | where name =~ $buffer
| each { |it| {value: $it.name description: $it.usage} } | each { |it| {
value: $it.name
description: $it.usage
} }
} }
} }
] ]

View file

@ -1,21 +1,30 @@
let-env ENV_CONVERSIONS = { let-env ENV_CONVERSIONS = {
"PATH": { "PATH": {
from_string: { |s| $s | split row (char esep) | path expand -n } from_string: { |string|
to_string: { |v| $v | path expand -n | str join (char esep) } $string
| split row (char esep)
| path expand -n
}
to_string: { |value|
$value
| path expand -n
| str join (char esep)
}
} }
} }
let-env NU_LIB_DIRS = [ let-env NU_LIB_DIRS = [
($nu.config-path | path dirname | path join 'scripts') ($nu.config-path
| path dirname
| path join 'scripts')
] ]
let-env NU_PLUGIN_DIRS = [ let-env NU_PLUGIN_DIRS = [
($nu.config-path | path dirname | path join 'plugins') ($nu.config-path
| path dirname
| path join 'plugins')
] ]
# STARSHIP
let-env config = $env.config | upsert render_right_prompt_on_last_line true
let-env STARSHIP_SHELL = "nu" let-env STARSHIP_SHELL = "nu"
let-env STARSHIP_SESSION_KEY = (random chars -l 16) let-env STARSHIP_SESSION_KEY = (random chars -l 16)
@ -23,11 +32,11 @@ let-env PROMPT_INDICATOR = ""
let-env PROMPT_MULTILINE_INDICATOR = (^/run/current-system/sw/bin/starship prompt --continuation) let-env PROMPT_MULTILINE_INDICATOR = (^/run/current-system/sw/bin/starship prompt --continuation)
let-env PROMPT_COMMAND = { || let-env PROMPT_COMMAND = { ||
let width = (term size).columns let width = term size | get columns
^/run/current-system/sw/bin/starship prompt $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)" ^/run/current-system/sw/bin/starship prompt $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
} }
let-env PROMPT_COMMAND_RIGHT = { || let-env PROMPT_COMMAND_RIGHT = { ||
let width = (term size).columns let width = term size | get columns
^/run/current-system/sw/bin/starship prompt --right $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)" ^/run/current-system/sw/bin/starship prompt --right $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
} }