/ modules / common / nushell / config.nu
config.nu
  1  $env.config = {
  2    bracketed_paste: true
  3    buffer_editor: ""
  4    datetime_format: {}
  5    edit_mode: vi
  6    error_style: fancy
  7    float_precision: 2
  8    footer_mode: 25
  9    render_right_prompt_on_last_line: false
 10    show_banner: false
 11    use_ansi_coloring: true
 12    use_kitty_protocol: true
 13  
 14    shell_integration: {
 15      osc2: false
 16      osc7: true
 17      osc8: true
 18      osc9_9: false
 19      osc133: true
 20      osc633: true
 21      reset_application_mode: true
 22    }
 23  }
 24  
 25  $env.config.ls = {
 26    clickable_links: true
 27    use_ls_colors: true
 28  }
 29  
 30  $env.config.rm.always_trash = false
 31  
 32  $env.config.table = {
 33    header_on_separator: false
 34    index_mode: always
 35    mode: rounded
 36    padding: { left: 1 right: 1 }
 37    show_empty: true
 38    trim: {
 39      methodology: wrapping
 40      wrapping_try_keep_words: true
 41      truncating_suffix: "..."
 42    }
 43  }
 44  
 45  $env.config.history = {
 46    file_format: sqlite
 47    isolation: false
 48    max_size: 100_000
 49    sync_on_enter: true
 50  }
 51  
 52  $env.config.completions = {
 53    algorithm: prefix
 54    case_sensitive: false
 55    partial: true
 56    quick: true
 57    external: {
 58      enable: true
 59      max_results: 100
 60      completer: {|tokens: list<string>|
 61        let expanded = scope aliases | where name == $tokens.0 | get --ignore-errors expansion.0
 62  
 63        mut expanded_tokens = if $expanded != null and $tokens.0 != "cd" {
 64          $expanded | split row " " | append ($tokens | skip 1)
 65        } else {
 66          $tokens
 67        }
 68  
 69        $expanded_tokens.0 = ($expanded_tokens.0 | str trim --left --char "^")
 70  
 71        fish --command $"complete '--do-complete=($expanded_tokens | str join ' ')'"
 72        | $"value(char tab)description(char newline)" + $in
 73        | from tsv --flexible --no-infer
 74      }
 75    }
 76  }
 77  
 78  $env.config.cursor_shape = {
 79    vi_insert: line
 80    vi_normal: block
 81  }
 82  
 83  $env.config.hooks = {
 84    command_not_found: {||}
 85  
 86    display_output: {
 87      tee { table --expand | print }
 88      | $env.last = $in
 89    }
 90  
 91    env_change: {}
 92  
 93    pre_execution: [
 94      {
 95        let prompt = commandline | str trim
 96  
 97        if ($prompt | is-empty) {
 98          return
 99        }
100  
101        print $"(ansi title)($prompt) — nu(char bel)"
102      }
103    ]
104  
105    pre_prompt: [
106      {
107        # Move cursor to bottom of screen and column 1
108        print -n "\e[999B\e[1G"
109      }
110    ]
111  }
112  
113  # Retrieve the output of the last command
114  def _ []: nothing -> any {
115    $env.last
116  }
117  
118  # Auto-generated menus with proper theme colors will be handled by ThemeNix
119  # Auto-generated keybindings will be handled by ThemeNix
120  
121  # The actual color_config, menus, and keybindings will be auto-generated 
122  # by ThemeNix based on the arabia colors defined in theme.nix