2025-07-19 17:33:22 +02:00
|
|
|
#! /usr/bin/env nu
|
|
|
|
|
|
|
|
$env.config = {
|
|
|
|
bracketed_paste: true
|
|
|
|
buffer_editor: "hx"
|
|
|
|
datetime_format: {}
|
|
|
|
edit_mode: vi
|
|
|
|
error_style: fancy
|
|
|
|
float_precision: 2
|
|
|
|
footer_mode: 25
|
|
|
|
render_right_prompt_on_last_line: false
|
|
|
|
show_banner: false
|
|
|
|
use_ansi_coloring: true
|
|
|
|
use_kitty_protocol: true
|
|
|
|
|
|
|
|
shell_integration: {
|
|
|
|
osc2: false
|
|
|
|
osc7: true
|
|
|
|
osc8: true
|
|
|
|
osc9_9: false
|
|
|
|
osc133: true
|
|
|
|
osc633: true
|
|
|
|
reset_application_mode: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$env.config.ls = {
|
|
|
|
clickable_links: true
|
|
|
|
use_ls_colors: true
|
|
|
|
}
|
|
|
|
|
|
|
|
$env.config.rm.always_trash = true
|
|
|
|
|
|
|
|
$env.config.table = {
|
|
|
|
header_on_separator: true
|
|
|
|
footer_inheritance: true
|
|
|
|
index_mode: always
|
|
|
|
mode: compact
|
|
|
|
missing_value_symbol: kek
|
|
|
|
padding: {left: 1 right: 1}
|
|
|
|
show_empty: false
|
|
|
|
trim: {
|
|
|
|
methodology: wrapping
|
|
|
|
truncating_suffix: "..."
|
|
|
|
wrapping_try_keep_words: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$env.config.explore = {
|
|
|
|
command_bar_text: {fg: "#C4C9C6"}
|
|
|
|
highlight: {fg: black bg: yellow}
|
|
|
|
status: {
|
|
|
|
error: {fg: white bg: red}
|
|
|
|
warn: {}
|
|
|
|
info: {}
|
|
|
|
}
|
|
|
|
status_bar_background: {fg: "#1D1F21" bg: "#C4C9C6"}
|
|
|
|
table: {
|
|
|
|
split_line: {fg: "#404040"}
|
|
|
|
selected_cell: {bg: light_blue}
|
|
|
|
selected_row: {}
|
|
|
|
selected_column: {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$env.config.history = {
|
|
|
|
file_format: sqlite
|
|
|
|
isolation: false
|
|
|
|
max_size: 100_000
|
|
|
|
sync_on_enter: true
|
|
|
|
}
|
|
|
|
|
|
|
|
$env.config.cursor_shape = {
|
|
|
|
vi_insert: line
|
|
|
|
vi_normal: block
|
|
|
|
}
|
|
|
|
|
|
|
|
$env.config.hooks = {
|
|
|
|
command_not_found: {|| }
|
|
|
|
|
|
|
|
pre_execution: [
|
|
|
|
{
|
|
|
|
let prompt = commandline | str trim
|
|
|
|
|
|
|
|
if ($prompt | is-empty) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
print $"(ansi title)($prompt) — nu(char bel)"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
env_change: {
|
|
|
|
PWD: [
|
|
|
|
{||
|
|
|
|
if not ($env.PWD | path join .envrc | path exists) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if (which direnv | is-empty) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
direnv export json | from json | default {} | load-env
|
|
|
|
$env.PATH = $env.PATH | split row (char env_sep)
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-07-20 02:14:20 +02:00
|
|
|
let menus = [
|
2025-07-19 17:33:22 +02:00
|
|
|
{
|
2025-07-20 02:14:20 +02:00
|
|
|
name: completion_menu
|
|
|
|
only_buffer_difference: false
|
|
|
|
marker: "(ansi yellow)╋ "
|
|
|
|
type: {
|
|
|
|
layout: ide
|
|
|
|
min_completion_width: 0
|
|
|
|
max_completion_width: 150
|
|
|
|
max_completion_height: 25
|
|
|
|
padding: 0
|
|
|
|
border: false
|
|
|
|
cursor_offset: 0
|
|
|
|
description_mode: "prefer_right"
|
|
|
|
min_description_width: 0
|
|
|
|
max_description_width: 50
|
|
|
|
max_description_height: 10
|
|
|
|
description_offset: 1
|
|
|
|
correct_cursor_pos: true
|
|
|
|
}
|
2025-07-19 17:33:22 +02:00
|
|
|
style: {
|
2025-07-20 02:14:20 +02:00
|
|
|
text: white
|
|
|
|
selected_text: white_reverse
|
2025-07-19 17:33:22 +02:00
|
|
|
description_text: yellow
|
2025-07-20 02:14:20 +02:00
|
|
|
match_text: { attr: u }
|
|
|
|
selected_match_text: { attr: ur }
|
2025-07-19 17:33:22 +02:00
|
|
|
}
|
2025-07-20 02:14:20 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name: history_menu
|
|
|
|
only_buffer_difference: true
|
|
|
|
marker: $env.PROMPT_INDICATOR
|
2025-07-19 17:33:22 +02:00
|
|
|
type: {
|
2025-07-20 02:14:20 +02:00
|
|
|
layout: list
|
|
|
|
page_size: 10
|
|
|
|
}
|
|
|
|
style: {
|
|
|
|
text: white
|
|
|
|
selected_text: white_reverse
|
2025-07-19 17:33:22 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2025-07-20 02:14:20 +02:00
|
|
|
$env.config.menus = $env.config.menus
|
|
|
|
| where name not-in ($menus | get name)
|
|
|
|
| append $menus
|
|
|
|
|
|
|
|
$env.config.keybindings ++= [
|
2025-07-19 17:33:22 +02:00
|
|
|
{
|
|
|
|
name: copy_commandline
|
|
|
|
modifier: alt
|
|
|
|
keycode: char_c
|
|
|
|
mode: [vi_normal vi_insert]
|
|
|
|
event: {
|
|
|
|
send: executehostcommand
|
|
|
|
cmd: 'commandline | nu-highlight | $"```ansi\n($in)\n```" | wl-copy $in'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
let env_vars_file = '/tmp/nushell-env-vars'
|
|
|
|
if not ($env_vars_file | path exists) {
|
|
|
|
open /etc/profile
|
|
|
|
| lines
|
|
|
|
| select 11
|
|
|
|
| str trim
|
|
|
|
| split column ' ' del path
|
|
|
|
| get path.0
|
|
|
|
| open $in
|
|
|
|
| str trim
|
|
|
|
| lines
|
|
|
|
| parse 'export {name}="{value}"'
|
|
|
|
| transpose --header-row --as-record
|
|
|
|
| tee { load-env $in }
|
|
|
|
| to nuon
|
|
|
|
| save --force $env_vars_file
|
|
|
|
} else {
|
|
|
|
open $env_vars_file
|
|
|
|
| from nuon
|
|
|
|
| load-env $in
|
|
|
|
}
|
|
|
|
|
2025-07-19 21:51:37 +02:00
|
|
|
def switch [] {
|
2025-07-19 23:52:20 +02:00
|
|
|
nh os switch --file ($env.NH_FLAKE | path join default.nix) (open /etc/hostname | str trim)
|
2025-07-19 21:51:37 +02:00
|
|
|
}
|
|
|
|
|
2025-07-19 17:33:22 +02:00
|
|
|
# fix sudo by prepending /run/wrappers/bin to the PATH.
|
|
|
|
$env.PATH = ($env.PATH | split row (char esep) | prepend '/run/wrappers/bin')
|
|
|
|
|
|
|
|
$env.CARAPACE_BRIDGES = 'inshellisense,fish,carapace,clap,bash'
|
|
|
|
$env.CARAPACE_MATCH = 1
|
|
|
|
|
|
|
|
# Set environment variables according to the path of the clone
|
|
|
|
$env.TOPIARY_CONFIG_FILE = ($env.HOME | path join .config | path join topiary languages.ncl)
|
|
|
|
$env.TOPIARY_LANGUAGE_DIR = ($env.HOME | path join .config | path join topiary languages)
|
|
|
|
# The prompt indicators are environmental variables that represent
|
|
|
|
# the state of the prompt.
|