#! /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.color_config = { binary: '#b48ead' block: '#81a1c1' cell-path: '#e5e9f0' closure: '#88c0d0' custom: '#8fbcbb' duration: '#ebcb8b' float: '#bf616a' glob: '#8fbcbb' int: '#b48ead' list: '#88c0d0' nothing: '#bf616a' range: '#ebcb8b' record: '#88c0d0' string: '#a3be8c' bool: {|| if $in { '#88c0d0' } else { '#ebcb8b' } } datetime: {|| (date now) - $in | if $in < 1hr { { fg: '#bf616a' attr: 'b' } } else if $in < 6hr { '#bf616a' } else if $in < 1day { '#ebcb8b' } else if $in < 3day { '#a3be8c' } else if $in < 1wk { { fg: '#a3be8c' attr: 'b' } } else if $in < 6wk { '#88c0d0' } else if $in < 52wk { '#81a1c1' } else { 'dark_gray' } } filesize: {|e| if $e == 0b { '#e5e9f0' } else if $e < 1mb { '#88c0d0' } else {{ fg: '#81a1c1' }} } shape_and: { fg: '#b48ead' attr: 'b' } shape_binary: { fg: '#b48ead' attr: 'b' } shape_block: { fg: '#81a1c1' attr: 'b' } shape_bool: '#88c0d0' shape_closure: { fg: '#88c0d0' attr: 'b' } shape_custom: '#a3be8c' shape_datetime: { fg: '#88c0d0' attr: 'b' } shape_directory: '#88c0d0' shape_external: '#88c0d0' shape_external_resolved: '#88c0d0' shape_externalarg: { fg: '#a3be8c' attr: 'b' } shape_filepath: '#88c0d0' shape_flag: { fg: '#81a1c1' attr: 'b' } shape_float: { fg: '#bf616a' attr: 'b' } shape_garbage: { fg: '#FFFFFF' bg: '#FF0000' attr: 'b' } shape_glob_interpolation: { fg: '#88c0d0' attr: 'b' } shape_globpattern: { fg: '#88c0d0' attr: 'b' } shape_int: { fg: '#b48ead' attr: 'b' } shape_internalcall: { fg: '#88c0d0' attr: 'b' } shape_keyword: { fg: '#b48ead' attr: 'b' } shape_list: { fg: '#88c0d0' attr: 'b' } shape_literal: '#81a1c1' shape_match_pattern: '#a3be8c' shape_matching_brackets: { attr: 'u' } shape_nothing: '#bf616a' shape_operator: '#ebcb8b' shape_or: { fg: '#b48ead' attr: 'b' } shape_pipe: { fg: '#b48ead' attr: 'b' } shape_range: { fg: '#ebcb8b' attr: 'b' } shape_raw_string: { fg: '#8fbcbb' attr: 'b' } shape_record: { fg: '#88c0d0' attr: 'b' } shape_redirection: { fg: '#b48ead' attr: 'b' } shape_signature: { fg: '#a3be8c' attr: 'b' } shape_string: '#a3be8c' shape_string_interpolation: { fg: '#88c0d0' attr: 'b' } shape_table: { fg: '#81a1c1' attr: 'b' } shape_vardecl: { fg: '#81a1c1' attr: 'u' } shape_variable: '#b48ead' foreground: '#e5e9f0' background: '#2e3440' cursor: '#e5e9f0' empty: '#81a1c1' header: { fg: '#a3be8c' attr: 'b' } hints: '#4c566a' leading_trailing_space_bg: { attr: 'n' } row_index: { fg: '#a3be8c' attr: 'b' } search_result: { fg: '#bf616a' bg: '#e5e9f0' } separator: '#e5e9f0' } $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) } ] } } let menus = [ { 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 } style: { text: white selected_text: white_reverse description_text: yellow match_text: { attr: u } selected_match_text: { attr: ur } } } { name: history_menu only_buffer_difference: true marker: $env.PROMPT_INDICATOR type: { layout: list page_size: 10 } style: { text: white selected_text: white_reverse } } ] $env.config.menus = $env.config.menus | where name not-in ($menus | get name) | append $menus $env.config.keybindings ++= [ { 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 } def switch [] { nh os switch --file ($env.NH_FLAKE | path join default.nix) (open /etc/hostname | str trim) } # fix sudo by prepending /run/wrappers/bin to the PATH. $env.PATH = ($env.PATH | split row (char esep) | prepend '/run/wrappers/bin') $env.PATH = ($env.PATH | split row (char esep) | prepend '/etc/profiles/per-user/cr/bin') carapace _carapace nushell | save -f ($nu.user-autoload-dirs | path join carapace.nu) source ./prompt.nu source ./zoxide.nu