config-dump/nushell/config.nu

314 lines
6.7 KiB
Text
Raw Permalink Normal View History

2025-07-01 08:43:46 +02:00
$env.config = {
2025-07-17 00:55:24 +02:00
bracketed_paste: true
buffer_editor: "hx"
datetime_format: {}
edit_mode: vi
error_style: fancy
float_precision: 2
footer_mode: 25
2025-07-01 08:43:46 +02:00
render_right_prompt_on_last_line: false
2025-07-17 00:55:24 +02:00
show_banner: false
use_ansi_coloring: true
use_kitty_protocol: true
2025-07-01 08:43:46 +02:00
shell_integration: {
2025-07-17 00:55:24 +02:00
osc2: false
osc7: true
osc8: true
osc9_9: false
osc133: true
osc633: true
2025-07-01 08:43:46 +02:00
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: false
index_mode: always
2025-07-17 00:55:24 +02:00
mode: light
padding: {left: 1 right: 1}
2025-07-01 08:43:46 +02:00
show_empty: true
trim: {
2025-07-17 00:55:24 +02:00
methodology: wrapping
2025-07-01 08:43:46 +02:00
wrapping_try_keep_words: true
2025-07-17 00:55:24 +02:00
truncating_suffix: "..."
2025-07-01 08:43:46 +02:00
}
}
$env.config.explore = {
2025-07-17 00:55:24 +02:00
command_bar_text: {fg: "#C4C9C6"}
highlight: {fg: black bg: yellow}
2025-07-01 08:43:46 +02:00
status: {
2025-07-17 00:55:24 +02:00
error: {fg: white bg: red}
warn: {}
info: {}
2025-07-01 08:43:46 +02:00
}
2025-07-17 00:55:24 +02:00
status_bar_background: {fg: "#1D1F21" bg: "#C4C9C6"}
2025-07-01 08:43:46 +02:00
table: {
2025-07-17 00:55:24 +02:00
split_line: {fg: "#404040"}
selected_cell: {bg: light_blue}
selected_row: {}
2025-07-01 08:43:46 +02:00
selected_column: {}
}
}
$env.config.history = {
2025-07-17 00:55:24 +02:00
file_format: sqlite
isolation: false
max_size: 100_000
2025-07-01 08:43:46 +02:00
sync_on_enter: true
}
$env.config.cursor_shape = {
2025-07-15 21:31:31 +02:00
vi_insert: line
2025-07-01 08:43:46 +02:00
vi_normal: block
}
$env.config.hooks = {
2025-07-17 00:55:24 +02:00
command_not_found: {|| }
2025-07-01 08:43:46 +02:00
pre_execution: [
{
let prompt = commandline | str trim
if ($prompt | is-empty) {
return
}
print $"(ansi title)($prompt) — nu(char bel)"
}
]
pre_prompt: [
{
2025-07-17 00:55:24 +02:00
if (which direnv | is-empty) {
2025-07-01 08:43:46 +02:00
return
2025-07-17 00:55:24 +02:00
}
2025-07-01 08:43:46 +02:00
2025-07-17 00:55:24 +02:00
direnv export json | from json | default {} | load-env
# Direnv outputs $PATH as a string, but nushell silently breaks if isn't a list-like table.
# The following behemoth of Nu code turns this into nu's format while following the standards of how to handle quotes, use it if you need quote handling instead of the line below it:
# $env.PATH = $env.PATH | parse --regex ('' + `((?:(?:"(?:(?:\\[\\"])|.)*?")|(?:'.*?')|[^` + (char env_sep) + `]*)*)`) | each {|x| $x.capture0 | parse --regex `(?:"((?:(?:\\"|.))*?)")|(?:'(.*?)')|([^'"]*)` | each {|y| if ($y.capture0 != "") { $y.capture0 | str replace -ar `\\([\\"])` `$1` } else if ($y.capture1 != "") { $y.capture1 } else $y.capture2 } | str join }
$env.PATH = $env.PATH | split row (char env_sep)
2025-07-01 08:43:46 +02:00
}
]
}
$env.config.menus = [
{
2025-07-17 00:55:24 +02:00
marker: $"(ansi yellow)╋ "
name: help_menu
2025-07-01 08:43:46 +02:00
only_buffer_difference: true
style: {
description_text: yellow
2025-07-17 00:55:24 +02:00
selected_text: red_reverse
text: yellow
2025-07-01 08:43:46 +02:00
}
type: {
2025-07-17 00:55:24 +02:00
col_padding: 2
col_width: 20
columns: 4
2025-07-01 08:43:46 +02:00
description_rows: 10
2025-07-17 00:55:24 +02:00
layout: description
selection_rows: 4
2025-07-01 08:43:46 +02:00
}
}
]
$env.config.keybindings = [
{
name: copy_commandline
modifier: alt
keycode: char_c
2025-07-17 00:55:24 +02:00
mode: [vi_normal vi_insert]
2025-07-01 08:43:46 +02:00
event: {
send: executehostcommand
2025-07-15 21:31:31 +02:00
cmd: 'commandline | nu-highlight | $"```ansi\n($in)\n```" | wl-copy $in'
2025-07-01 08:43:46 +02:00
}
}
{
2025-07-17 00:55:24 +02:00
name: escape
2025-07-01 08:43:46 +02:00
modifier: none
2025-07-17 00:55:24 +02:00
keycode: escape
mode: [vi_normal vi_insert]
event: {send: esc}
2025-07-01 08:43:46 +02:00
}
{
2025-07-17 00:55:24 +02:00
name: cancel_command
2025-07-01 08:43:46 +02:00
modifier: control
2025-07-17 00:55:24 +02:00
keycode: char_c
mode: [vi_normal vi_insert]
event: {send: ctrlc}
2025-07-01 08:43:46 +02:00
}
{
2025-07-17 00:55:24 +02:00
name: quit_shell
2025-07-01 08:43:46 +02:00
modifier: control
2025-07-17 00:55:24 +02:00
keycode: char_d
mode: [vi_normal vi_insert]
event: {send: ctrld}
2025-07-01 08:43:46 +02:00
}
{
2025-07-17 00:55:24 +02:00
name: clear_screen
2025-07-01 08:43:46 +02:00
modifier: control
2025-07-17 00:55:24 +02:00
keycode: char_l
mode: [vi_normal vi_insert]
event: {send: clearscreen}
2025-07-01 08:43:46 +02:00
}
{
2025-07-17 00:55:24 +02:00
name: open_command_editor
2025-07-01 08:43:46 +02:00
modifier: control
2025-07-17 00:55:24 +02:00
keycode: char_o
mode: [vi_normal vi_insert]
event: {send: openeditor}
2025-07-01 08:43:46 +02:00
}
{
2025-07-17 00:55:24 +02:00
name: abbr
2025-07-01 08:43:46 +02:00
modifier: control
2025-07-17 00:55:24 +02:00
keycode: space
mode: [vi_normal vi_insert]
2025-07-01 08:43:46 +02:00
event: [
2025-07-17 00:55:24 +02:00
{send: menu name: abbr_menu}
{edit: insertchar value: " "}
2025-07-01 08:43:46 +02:00
]
}
{
2025-07-17 00:55:24 +02:00
name: move_down
2025-07-01 08:43:46 +02:00
modifier: none
2025-07-17 00:55:24 +02:00
keycode: down
mode: [vi_normal vi_insert]
event: {
2025-07-01 08:43:46 +02:00
until: [
2025-07-17 00:55:24 +02:00
{send: menudown}
{send: down}
2025-07-01 08:43:46 +02:00
]
}
}
{
2025-07-17 00:55:24 +02:00
name: move_left
2025-07-01 08:43:46 +02:00
modifier: none
2025-07-17 00:55:24 +02:00
keycode: left
mode: [vi_normal vi_insert]
event: {
2025-07-01 08:43:46 +02:00
until: [
2025-07-17 00:55:24 +02:00
{send: menuleft}
{send: left}
2025-07-01 08:43:46 +02:00
]
}
}
{
2025-07-17 00:55:24 +02:00
name: move_right_or_take_history_hint
2025-07-01 08:43:46 +02:00
modifier: none
2025-07-17 00:55:24 +02:00
keycode: right
mode: [vi_normal vi_insert]
event: {
2025-07-01 08:43:46 +02:00
until: [
2025-07-17 00:55:24 +02:00
{send: historyhintcomplete}
{send: menuright}
{send: right}
2025-07-01 08:43:46 +02:00
]
}
}
{
2025-07-17 00:55:24 +02:00
name: move_one_word_left
2025-07-01 08:43:46 +02:00
modifier: control
2025-07-17 00:55:24 +02:00
keycode: left
mode: [vi_normal vi_insert]
event: {edit: movewordleft}
2025-07-01 08:43:46 +02:00
}
{
2025-07-17 00:55:24 +02:00
name: move_one_word_right_or_take_history_hint
2025-07-01 08:43:46 +02:00
modifier: control
2025-07-17 00:55:24 +02:00
keycode: right
mode: [vi_normal vi_insert]
event: {
2025-07-01 08:43:46 +02:00
until: [
2025-07-17 00:55:24 +02:00
{send: historyhintwordcomplete}
{edit: movewordright}
2025-07-01 08:43:46 +02:00
]
}
}
{
2025-07-17 00:55:24 +02:00
name: move_to_line_start
2025-07-01 08:43:46 +02:00
modifier: control
2025-07-17 00:55:24 +02:00
keycode: char_a
mode: [vi_normal vi_insert]
event: {edit: movetolinestart}
2025-07-01 08:43:46 +02:00
}
{
2025-07-17 00:55:24 +02:00
name: move_to_line_end_or_take_history_hint
2025-07-01 08:43:46 +02:00
modifier: control
2025-07-17 00:55:24 +02:00
keycode: char_e
mode: [vi_normal vi_insert]
event: {
2025-07-01 08:43:46 +02:00
until: [
2025-07-17 00:55:24 +02:00
{send: historyhintcomplete}
{edit: movetolineend}
2025-07-01 08:43:46 +02:00
]
}
}
{
2025-07-17 00:55:24 +02:00
name: delete_one_character_backward
2025-07-01 08:43:46 +02:00
modifier: none
2025-07-17 00:55:24 +02:00
keycode: backspace
mode: vi_insert
event: {edit: backspace}
2025-07-01 08:43:46 +02:00
}
{
2025-07-17 00:55:24 +02:00
name: delete_one_word_backward
2025-07-01 08:43:46 +02:00
modifier: control
2025-07-17 00:55:24 +02:00
keycode: backspace
mode: vi_insert
event: {edit: backspaceword}
2025-07-01 08:43:46 +02:00
}
{
2025-07-17 00:55:24 +02:00
name: newline_or_run_command
2025-07-01 08:43:46 +02:00
modifier: none
2025-07-17 00:55:24 +02:00
keycode: enter
mode: vi_insert
event: {send: enter}
2025-07-01 08:43:46 +02:00
}
{
2025-07-17 00:55:24 +02:00
name: take_history_hint
2025-07-01 08:43:46 +02:00
modifier: control
2025-07-17 00:55:24 +02:00
keycode: char_f
mode: [vi_normal vi_insert]
event: {
2025-07-01 08:43:46 +02:00
until: [
2025-07-17 00:55:24 +02:00
{send: historyhintcomplete}
2025-07-01 08:43:46 +02:00
]
}
}
]
2025-07-17 00:55:24 +02:00
let autoload_dir = $nu.user-autoload-dirs.0
mkdir $autoload_dir
zoxide init nushell --cmd cd | save -f ($autoload_dir | path join zoxide.nu)
atuin init nu | save -f ($autoload_dir | path join atuin.nu)
carapace _carapace nushell | save -f ($autoload_dir | path join carapace.nu)
2025-07-15 21:31:31 +02:00
source ./source_profile.nu
source ./prompt.nu
2025-07-01 08:43:46 +02:00
2025-07-15 21:31:31 +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.LS_COLORS = (vivid generate lava)
$env.EDITOR = "hx"
2025-07-01 08:43:46 +02:00
2025-07-17 00:55:24 +02:00
$env.CARAPACE_BRIDGES = 'carapace,clap,inshellisense,fish'
$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)
2025-07-01 08:43:46 +02:00
# The prompt indicators are environmental variables that represent
2025-07-15 21:31:31 +02:00
# the state of the prompt.