1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-29 11:07: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,39 +1,46 @@
let theme = {
filesize: {|e|
if $e == 0b {
filesize: { |size|
if $size == 0b {
'white'
} else if $e < 1mb {
} else if $size < 1mb {
'cyan'
} else { 'blue' }
} else {
'blue'
}
}
date: {|| (date now) - $in |
if $in < 1hr {
'red3b'
} else if $in < 6hr {
'orange3'
} else if $in < 1day {
'yellow3b'
} else if $in < 3day {
'chartreuse2b'
} else if $in < 1wk {
'green3b'
} else if $in < 6wk {
'darkturquoise'
} else if $in < 52wk {
'deepskyblue3b'
} else { 'dark_gray' }
date: { ||
(date now) - $in |
if $in < 1hr {
'red3b'
} else if $in < 6hr {
'orange3'
} else if $in < 1day {
'yellow3b'
} else if $in < 3day {
'chartreuse2b'
} else if $in < 1wk {
'green3b'
} else if $in < 6wk {
'darkturquoise'
} else if $in < 52wk {
'deepskyblue3b'
} else {
'dark_gray'
}
}
bool: {||
bool: { ||
if $in {
'light_cyan'
} else {
'light_gray'
}
'light_cyan'
} else {
'light_gray'
}
}
leading_trailing_space_bg: { attr: n }
leading_trailing_space_bg: {
attr: n
}
empty: blue
hints: dark_gray
@ -52,8 +59,16 @@ let theme = {
list: white
block: white
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
shape_matching_brackets: { attr: u }
shape_garbage: {
fg: "#FFFFFF"
bg: "#FF0000"
attr: b
}
shape_matching_brackets: {
attr: u
}
shape_and: purple_bold
shape_binary: purple_bold
shape_block: blue_bold
@ -107,6 +122,7 @@ let-env config = {
mode: rounded
index_mode: always
show_empty: true
trim: {
methodology: wrapping
wrapping_try_keep_words: true
@ -118,8 +134,16 @@ let-env config = {
help_banner: true
exit_esc: true
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: {
split_line: '#404040'
@ -133,12 +157,15 @@ let-env config = {
}
config: {
cursor_color: {bg: 'yellow' fg: 'black' }
cursor_color: {
bg: 'yellow'
fg: 'black'
}
}
}
history: {
max_size: 10000
max_size: 1000
sync_on_enter: true
file_format: "plaintext"
}
@ -147,7 +174,8 @@ let-env config = {
case_sensitive: false
quick: true
partial: true
algorithm: "prefix"
algorithm: "fuzzy"
external: {
enable: true
max_results: 100
@ -172,11 +200,15 @@ let-env config = {
use_ansi_coloring: true
edit_mode: vi
shell_integration: false
render_right_prompt_on_last_line: false
render_right_prompt_on_last_line: true
hooks: {
display_output: {||
if (term size).columns >= 100 { table -e } else { table }
display_output: { ||
if (term size).columns >= 100 {
table -e
} else {
table
}
}
}
@ -185,12 +217,14 @@ let-env config = {
name: completion_menu
only_buffer_difference: false
marker: "| "
type: {
layout: columnar
columns: 4
col_width: 20
col_padding: 2
}
style: {
text: green
selected_text: green_reverse
@ -201,10 +235,12 @@ let-env config = {
name: history_menu
only_buffer_difference: true
marker: "? "
type: {
layout: list
page_size: 10
}
style: {
text: green
selected_text: green_reverse
@ -215,6 +251,7 @@ let-env config = {
name: help_menu
only_buffer_difference: true
marker: "? "
type: {
layout: description
columns: 4
@ -223,6 +260,7 @@ let-env config = {
selection_rows: 4
description_rows: 10
}
style: {
text: green
selected_text: green_reverse
@ -233,47 +271,60 @@ let-env config = {
name: commands_menu
only_buffer_difference: false
marker: "# "
type: {
layout: columnar
columns: 4
col_width: 20
col_padding: 2
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
source: { |buffer, position|
$nu.scope.commands
| where name =~ $buffer
| each { |it| {value: $it.name description: $it.usage} }
| each { |it| {
value: $it.name
description: $it.usage
} }
}
}
{
name: vars_menu
only_buffer_difference: true
marker: "# "
type: {
layout: list
page_size: 10
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
source: { |buffer, position|
nu.scope.vars
| where name =~ $buffer
| sort-by name
| each { |it| {value: $it.name description: $it.type} }
| each { |it| {
value: $it.name
description: $it.type
} }
}
}
{
name: commands_with_description
only_buffer_difference: true
marker: "# "
type: {
layout: description
columns: 4
@ -282,15 +333,20 @@ let-env config = {
selection_rows: 4
description_rows: 10
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
source: { |buffer, position|
$nu.scope.commands
| 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 = {
"PATH": {
from_string: { |s| $s | split row (char esep) | path expand -n }
to_string: { |v| $v | path expand -n | str join (char esep) }
from_string: { |string|
$string
| split row (char esep)
| path expand -n
}
to_string: { |value|
$value
| path expand -n
| str join (char esep)
}
}
}
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 = [
($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_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_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)"
}
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)"
}