Skip to main content

max / alloy

7.9 KB · 208 lines History Blame Raw
1 @{! variants = default, night }
2 # Alloy Nushell config
3 #
4 # Loaded on every nu shell start. Configures nu's own behavior: table style,
5 # history, completions, keybindings, color palette for nu's own output.
6 #
7 # Aliases live in aliases.nu (sourced at the bottom).
8 # Environment lives in env.nu (loaded before this file by nu itself).
9
10 # -------------------------------------------------------------------
11 # Alloy color palette, @{meta.name}.
12 # Source of truth: makeover's themes/@{meta.id}.toml.
13 # -------------------------------------------------------------------
14 let alloy = {
15 surface: "@{surface.page}"
16 surface_raised: "@{surface.raised}"
17 border_subtle: "@{border.subtle}"
18 border: "@{line.border}"
19 text_muted: "@{content.muted}"
20 text_secondary: "@{content.secondary}"
21 text_primary: "@{content.primary}"
22 accent_error: "@{status.danger}"
23 accent_warn: "@{status.warning}"
24 accent_ok: "@{status.success}"
25 }
26
27 # -------------------------------------------------------------------
28 # Main config record
29 # -------------------------------------------------------------------
30 $env.config = {
31 show_banner: false
32
33 ls: {
34 use_ls_colors: true
35 clickable_links: false
36 }
37
38 table: {
39 mode: light
40 index_mode: always
41 show_empty: true
42 padding: { left: 1, right: 1 }
43 trim: {
44 methodology: wrapping
45 wrapping_try_keep_words: true
46 }
47 header_on_separator: false
48 }
49
50 error_style: fancy
51 display_errors: {
52 exit_code: false
53 termination_signal: true
54 }
55
56 footer_mode: 25
57 float_precision: 2
58 buffer_editor: "hx"
59 use_ansi_coloring: true
60 edit_mode: vi
61 shell_integration: {
62 osc2: true
63 osc7: true
64 osc8: true
65 osc9_9: false
66 osc133: true
67 osc633: true
68 reset_application_mode: true
69 }
70 render_right_prompt_on_last_line: false
71
72 rm: { always_trash: false }
73
74 history: {
75 # Upstream is Plaintext. sqlite is what gives history a session id, a
76 # cwd and an exit code per entry, which is what a recall worth having
77 # is built on.
78 file_format: "sqlite"
79 # Upstream default, restated because Alloy is a tiling desktop where
80 # several terminals open at once is the normal case: a command typed
81 # in one pane is recallable from the pane beside it, without waiting
82 # for either shell to exit. The cost, honestly: recall in a shell that
83 # has been open all day is interleaved with whatever the other panes
84 # did.
85 isolation: false
86 }
87
88 completions: {
89 case_sensitive: false
90 quick: true
91 partial: true
92 algorithm: "fuzzy"
93 external: {
94 enable: true
95 max_results: 100
96 completer: null
97 }
98 use_ls_colors: true
99 }
100
101 # `metric: true` and `format: "auto"` were this record's shape in an
102 # older nushell and are rejected by 0.112 as unknown options. The intent
103 # was metric units, which `unit` now carries.
104 filesize: {
105 unit: "metric"
106 show_unit: true
107 precision: 1
108 }
109
110 cursor_shape: {
111 emacs: line
112 vi_insert: block
113 vi_normal: underscore
114 }
115
116 color_config: {
117 separator: $alloy.border
118 leading_trailing_space_bg: { attr: n }
119 header: { fg: $alloy.text_primary attr: b }
120 empty: $alloy.text_muted
121 bool: $alloy.text_primary
122 int: $alloy.text_primary
123 filesize: $alloy.text_secondary
124 duration: $alloy.text_secondary
125 date: $alloy.text_secondary
126 range: $alloy.text_primary
127 float: $alloy.text_primary
128 string: $alloy.text_primary
129 nothing: $alloy.text_muted
130 binary: $alloy.text_secondary
131 cell-path: $alloy.text_primary
132 row_index: { fg: $alloy.text_muted attr: b }
133 record: $alloy.text_primary
134 list: $alloy.text_primary
135 block: $alloy.text_primary
136 hints: $alloy.text_muted
137 search_result: { fg: $alloy.accent_warn bg: $alloy.surface_raised }
138
139 shape_binary: { fg: $alloy.text_secondary attr: b }
140 shape_bool: $alloy.text_primary
141 shape_int: { fg: $alloy.text_primary attr: b }
142 shape_float: { fg: $alloy.text_primary attr: b }
143 shape_range: { fg: $alloy.accent_warn attr: b }
144 shape_internalcall: { fg: $alloy.text_primary attr: b }
145 shape_external: $alloy.text_secondary
146 shape_externalarg: { fg: $alloy.text_primary attr: b }
147 shape_literal: $alloy.text_secondary
148 shape_operator: $alloy.accent_warn
149 shape_signature: { fg: $alloy.text_secondary attr: b }
150 shape_string: $alloy.accent_ok
151 shape_string_interpolation: { fg: $alloy.accent_ok attr: b }
152 shape_datetime: { fg: $alloy.text_secondary attr: b }
153 shape_list: { fg: $alloy.text_primary attr: b }
154 shape_table: { fg: $alloy.text_primary attr: b }
155 shape_record: { fg: $alloy.text_primary attr: b }
156 shape_block: { fg: $alloy.text_primary attr: b }
157 shape_filepath: $alloy.text_secondary
158 shape_directory: $alloy.text_primary
159 shape_globpattern: { fg: $alloy.text_secondary attr: b }
160 shape_variable: $alloy.text_secondary
161 shape_flag: { fg: $alloy.text_secondary attr: b }
162 shape_pipe: { fg: $alloy.text_muted attr: b }
163 shape_and: { fg: $alloy.text_secondary attr: b }
164 shape_or: { fg: $alloy.text_secondary attr: b }
165 shape_redirection: { fg: $alloy.accent_warn attr: b }
166 shape_custom: $alloy.accent_ok
167 shape_nothing: $alloy.text_muted
168 shape_matching_brackets: { attr: u }
169 shape_garbage: { fg: $alloy.accent_error attr: b }
170 }
171
172 # This record is assigned wholesale, so these lists are a reset, not a
173 # starting point: a hook registered before this file runs is discarded
174 # here. Nothing does, and nothing should. The autoload directory is
175 # read after this file (direnv's hook lives there) and is the place to
176 # add one, per-user hooks go below any of this in your own config.
177 hooks: {
178 pre_prompt: []
179 pre_execution: []
180 env_change: {
181 PWD: []
182 }
183 display_output: null
184 command_not_found: null
185 }
186
187 menus: []
188 keybindings: []
189 }
190
191 # -------------------------------------------------------------------
192 # Integrations
193 # -------------------------------------------------------------------
194 # starship, zoxide and direnv are not set up here. They live in
195 # /usr/share/nushell/vendor/autoload/, which nushell sources by itself
196 # after this file runs (the first two generated at build time from their
197 # own init output, direnv hand-authored because it has no nu init to
198 # generate). See the Containerfile for why: `source` is
199 # a parse-time keyword, so it cannot take a path a `let` computed and it
200 # cannot be gated behind a runtime `if`. Written that way it was a parse
201 # error, and a parse error costs the whole file, not just its own line.
202
203 # -------------------------------------------------------------------
204 # Aliases (small, curated; see aliases.nu)
205 # -------------------------------------------------------------------
206 # `$nu` is a parse-time constant, so this path is one `source` can take.
207 source ($nu.default-config-dir | path join "aliases.nu")
208