| 1 | # Nushell Config File |
| 2 | # |
| 3 | # version = "0.99.1" |
| 4 | |
| 5 | # For more information on defining custom themes, see |
| 6 | # https://www.nushell.sh/book/coloring_and_theming.html |
| 7 | # And here is the theme collection |
| 8 | # https://github.com/nushell/nu_scripts/tree/main/themes |
| 9 | let dark_theme = { |
| 10 | # color for nushell primitives |
| 11 | separator: white |
| 12 | leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off |
| 13 | header: green_bold |
| 14 | empty: blue |
| 15 | # Closures can be used to choose colors for specific values. |
| 16 | # The value (in this case, a bool) is piped into the closure. |
| 17 | # eg) {|| if $in { 'light_cyan' } else { 'light_gray' } } |
| 18 | bool: light_cyan |
| 19 | int: white |
| 20 | filesize: cyan |
| 21 | duration: white |
| 22 | date: purple |
| 23 | range: white |
| 24 | float: white |
| 25 | string: white |
| 26 | nothing: white |
| 27 | binary: white |
| 28 | cell-path: white |
| 29 | row_index: green_bold |
| 30 | record: white |
| 31 | list: white |
| 32 | block: white |
| 33 | hints: dark_gray |
| 34 | search_result: { bg: red fg: white } |
| 35 | shape_and: purple_bold |
| 36 | shape_binary: purple_bold |
| 37 | shape_block: blue_bold |
| 38 | shape_bool: light_cyan |
| 39 | shape_closure: green_bold |
| 40 | shape_custom: green |
| 41 | shape_datetime: cyan_bold |
| 42 | shape_directory: cyan |
| 43 | shape_external: cyan |
| 44 | shape_externalarg: green_bold |
| 45 | shape_external_resolved: light_yellow_bold |
| 46 | shape_filepath: cyan |
| 47 | shape_flag: blue_bold |
| 48 | shape_float: purple_bold |
| 49 | # shapes are used to change the cli syntax highlighting |
| 50 | shape_garbage: { fg: white bg: red attr: b } |
| 51 | shape_glob_interpolation: cyan_bold |
| 52 | shape_globpattern: cyan_bold |
| 53 | shape_int: purple_bold |
| 54 | shape_internalcall: cyan_bold |
| 55 | shape_keyword: cyan_bold |
| 56 | shape_list: cyan_bold |
| 57 | shape_literal: blue |
| 58 | shape_match_pattern: green |
| 59 | shape_matching_brackets: { attr: u } |
| 60 | shape_nothing: light_cyan |
| 61 | shape_operator: yellow |
| 62 | shape_or: purple_bold |
| 63 | shape_pipe: purple_bold |
| 64 | shape_range: yellow_bold |
| 65 | shape_record: cyan_bold |
| 66 | shape_redirection: purple_bold |
| 67 | shape_signature: green_bold |
| 68 | shape_string: green |
| 69 | shape_string_interpolation: cyan_bold |
| 70 | shape_table: blue_bold |
| 71 | shape_variable: purple |
| 72 | shape_vardecl: purple |
| 73 | shape_raw_string: light_purple |
| 74 | } |
| 75 | |
| 76 | let light_theme = { |
| 77 | # color for nushell primitives |
| 78 | separator: dark_gray |
| 79 | leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off |
| 80 | header: green_bold |
| 81 | empty: blue |
| 82 | # Closures can be used to choose colors for specific values. |
| 83 | # The value (in this case, a bool) is piped into the closure. |
| 84 | # eg) {|| if $in { 'dark_cyan' } else { 'dark_gray' } } |
| 85 | bool: dark_cyan |
| 86 | int: dark_gray |
| 87 | filesize: cyan_bold |
| 88 | duration: dark_gray |
| 89 | date: purple |
| 90 | range: dark_gray |
| 91 | float: dark_gray |
| 92 | string: dark_gray |
| 93 | nothing: dark_gray |
| 94 | binary: dark_gray |
| 95 | cell-path: dark_gray |
| 96 | row_index: green_bold |
| 97 | record: dark_gray |
| 98 | list: dark_gray |
| 99 | block: dark_gray |
| 100 | hints: dark_gray |
| 101 | search_result: { fg: white bg: red } |
| 102 | shape_and: purple_bold |
| 103 | shape_binary: purple_bold |
| 104 | shape_block: blue_bold |
| 105 | shape_bool: light_cyan |
| 106 | shape_closure: green_bold |
| 107 | shape_custom: green |
| 108 | shape_datetime: cyan_bold |
| 109 | shape_directory: cyan |
| 110 | shape_external: cyan |
| 111 | shape_externalarg: green_bold |
| 112 | shape_external_resolved: light_purple_bold |
| 113 | shape_filepath: cyan |
| 114 | shape_flag: blue_bold |
| 115 | shape_float: purple_bold |
| 116 | # shapes are used to change the cli syntax highlighting |
| 117 | shape_garbage: { fg: white bg: red attr: b } |
| 118 | shape_glob_interpolation: cyan_bold |
| 119 | shape_globpattern: cyan_bold |
| 120 | shape_int: purple_bold |
| 121 | shape_internalcall: cyan_bold |
| 122 | shape_keyword: cyan_bold |
| 123 | shape_list: cyan_bold |
| 124 | shape_literal: blue |
| 125 | shape_match_pattern: green |
| 126 | shape_matching_brackets: { attr: u } |
| 127 | shape_nothing: light_cyan |
| 128 | shape_operator: yellow |
| 129 | shape_or: purple_bold |
| 130 | shape_pipe: purple_bold |
| 131 | shape_range: yellow_bold |
| 132 | shape_record: cyan_bold |
| 133 | shape_redirection: purple_bold |
| 134 | shape_signature: green_bold |
| 135 | shape_string: green |
| 136 | shape_string_interpolation: cyan_bold |
| 137 | shape_table: blue_bold |
| 138 | shape_variable: purple |
| 139 | shape_vardecl: purple |
| 140 | shape_raw_string: light_purple |
| 141 | } |
| 142 | |
| 143 | # External completer example |
| 144 | # let carapace_completer = {|spans| |
| 145 | # carapace $spans.0 nushell ...$spans | from json |
| 146 | # } |
| 147 | |
| 148 | # The default config record. This is where much of your global configuration is setup. |
| 149 | $env.config = { |
| 150 | show_banner: false # true or false to enable or disable the welcome banner at startup |
| 151 | |
| 152 | ls: { |
| 153 | use_ls_colors: false # use the LS_COLORS environment variable to colorize output |
| 154 | clickable_links: true # enable or disable clickable links. Your terminal has to support links. |
| 155 | } |
| 156 | |
| 157 | rm: { |
| 158 | always_trash: false # always act as if -t was given. Can be overridden with -p |
| 159 | } |
| 160 | |
| 161 | table: { |
| 162 | mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other |
| 163 | index_mode: always # "always" show indexes, "never" show indexes, "auto" = show indexes when a table has "index" column |
| 164 | show_empty: true # show 'empty list' and 'empty record' placeholders for command output |
| 165 | padding: { left: 1, right: 1 } # a left right padding of each column in a table |
| 166 | trim: { |
| 167 | methodology: wrapping # wrapping or truncating |
| 168 | wrapping_try_keep_words: true # A strategy used by the 'wrapping' methodology |
| 169 | truncating_suffix: "..." # A suffix used by the 'truncating' methodology |
| 170 | } |
| 171 | header_on_separator: false # show header text on separator/border line |
| 172 | # abbreviated_row_count: 10 # limit data rows from top and bottom after reaching a set point |
| 173 | } |
| 174 | |
| 175 | error_style: "fancy" # "fancy" or "plain" for screen reader-friendly error messages |
| 176 | |
| 177 | # Whether an error message should be printed if an error of a certain kind is triggered. |
| 178 | display_errors: { |
| 179 | exit_code: false # assume the external command prints an error message |
| 180 | # Core dump errors are always printed, and SIGPIPE never triggers an error. |
| 181 | # The setting below controls message printing for termination by all other signals. |
| 182 | termination_signal: true |
| 183 | } |
| 184 | |
| 185 | # datetime_format determines what a datetime rendered in the shell would look like. |
| 186 | # Behavior without this configuration point will be to "humanize" the datetime display, |
| 187 | # showing something like "a day ago." |
| 188 | datetime_format: { |
| 189 | # normal: '%a, %d %b %Y %H:%M:%S %z' # shows up in displays of variables or other datetime's outside of tables |
| 190 | # table: '%m/%d/%y %I:%M:%S%p' # generally shows up in tabular outputs such as ls. commenting this out will change it to the default human readable datetime format |
| 191 | } |
| 192 | |
| 193 | explore: { |
| 194 | status_bar_background: { fg: "#1D1F21", bg: "#C4C9C6" }, |
| 195 | command_bar_text: { fg: "#C4C9C6" }, |
| 196 | highlight: { fg: "black", bg: "yellow" }, |
| 197 | status: { |
| 198 | error: { fg: "white", bg: "red" }, |
| 199 | warn: {} |
| 200 | info: {} |
| 201 | }, |
| 202 | selected_cell: { bg: light_blue }, |
| 203 | } |
| 204 | |
| 205 | history: { |
| 206 | max_size: 100_000 # Session has to be reloaded for this to take effect |
| 207 | sync_on_enter: true # Enable to share history between multiple sessions, else you have to close the session to write history to file |
| 208 | file_format: "plaintext" # "sqlite" or "plaintext" |
| 209 | isolation: false # only available with sqlite file_format. true enables history isolation, false disables it. true will allow the history to be isolated to the current session using up/down arrows. false will allow the history to be shared across all sessions. |
| 210 | } |
| 211 | |
| 212 | completions: { |
| 213 | case_sensitive: false # set to true to enable case-sensitive completions |
| 214 | quick: true # set this to false to prevent auto-selecting completions when only one remains |
| 215 | partial: true # set this to false to prevent partial filling of the prompt |
| 216 | algorithm: "prefix" # prefix or fuzzy |
| 217 | sort: "smart" # "smart" (alphabetical for prefix matching, fuzzy score for fuzzy matching) or "alphabetical" |
| 218 | external: { |
| 219 | enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up may be very slow |
| 220 | max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options |
| 221 | completer: null # check 'carapace_completer' above as an example |
| 222 | } |
| 223 | use_ls_colors: false # set this to true to enable file/path/directory completions using LS_COLORS |
| 224 | } |
| 225 | |
| 226 | |
| 227 | cursor_shape: { |
| 228 | emacs: line # block, underscore, line, blink_block, blink_underscore, blink_line, inherit to skip setting cursor shape (line is the default) |
| 229 | vi_insert: block # block, underscore, line, blink_block, blink_underscore, blink_line, inherit to skip setting cursor shape (block is the default) |
| 230 | vi_normal: line # block, underscore, line, blink_block, blink_underscore, blink_line, inherit to skip setting cursor shape (underscore is the default) |
| 231 | } |
| 232 | |
| 233 | color_config: $dark_theme # if you want a more interesting theme, you can replace the empty record with `$dark_theme`, `$light_theme` or another custom record |
| 234 | footer_mode: 25 # always, never, number_of_rows, auto |
| 235 | float_precision: 2 # the precision for displaying floats in tables |
| 236 | buffer_editor: null # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL |
| 237 | use_ansi_coloring: true |
| 238 | bracketed_paste: true # enable bracketed paste, currently useless on windows |
| 239 | edit_mode: vi # emacs, vi |
| 240 | shell_integration: { |
| 241 | # osc2 abbreviates the path if in the home_dir, sets the tab/window title, shows the running command in the tab/window title |
| 242 | osc2: true |
| 243 | # osc7 is a way to communicate the path to the terminal, this is helpful for spawning new tabs in the same directory |
| 244 | osc7: true |
| 245 | # osc8 is also implemented as the deprecated setting ls.show_clickable_links, it shows clickable links in ls output if your terminal supports it. show_clickable_links is deprecated in favor of osc8 |
| 246 | osc8: true |
| 247 | # osc9_9 is from ConEmu and is starting to get wider support. It's similar to osc7 in that it communicates the path to the terminal |
| 248 | osc9_9: false |
| 249 | # osc133 is several escapes invented by Final Term which include the supported ones below. |
| 250 | # 133;A - Mark prompt start |
| 251 | # 133;B - Mark prompt end |
| 252 | # 133;C - Mark pre-execution |
| 253 | # 133;D;exit - Mark execution finished with exit code |
| 254 | # This is used to enable terminals to know where the prompt is, the command is, where the command finishes, and where the output of the command is |
| 255 | osc133: true |
| 256 | # osc633 is closely related to osc133 but only exists in visual studio code (vscode) and supports their shell integration features |
| 257 | # 633;A - Mark prompt start |
| 258 | # 633;B - Mark prompt end |
| 259 | # 633;C - Mark pre-execution |
| 260 | # 633;D;exit - Mark execution finished with exit code |
| 261 | # 633;E - Explicitly set the command line with an optional nonce |
| 262 | # 633;P;Cwd=<path> - Mark the current working directory and communicate it to the terminal |
| 263 | # and also helps with the run recent menu in vscode |
| 264 | osc633: true |
| 265 | # reset_application_mode is escape \x1b[?1l and was added to help ssh work better |
| 266 | reset_application_mode: true |
| 267 | } |
| 268 | render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt. |
| 269 | use_kitty_protocol: false # enables keyboard enhancement protocol implemented by kitty console, only if your terminal support this. |
| 270 | highlight_resolved_externals: false # true enables highlighting of external commands in the repl resolved by which. |
| 271 | recursion_limit: 50 # the maximum number of times nushell allows recursion before stopping it |
| 272 | |
| 273 | plugins: {} # Per-plugin configuration. See https://www.nushell.sh/contributor-book/plugins.html#configuration. |
| 274 | |
| 275 | plugin_gc: { |
| 276 | # Configuration for plugin garbage collection |
| 277 | default: { |
| 278 | enabled: true # true to enable stopping of inactive plugins |
| 279 | stop_after: 10sec # how long to wait after a plugin is inactive to stop it |
| 280 | } |
| 281 | plugins: { |
| 282 | # alternate configuration for specific plugins, by name, for example: |
| 283 | # |
| 284 | # gstat: { |
| 285 | # enabled: false |
| 286 | # } |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | hooks: { |
| 291 | pre_prompt: [{ null }] # run before the prompt is shown |
| 292 | pre_execution: [{ null }] # run before the repl input is run |
| 293 | env_change: { |
| 294 | PWD: [{|before, after| null }] # run if the PWD environment is different since the last repl input |
| 295 | } |
| 296 | display_output: "if (term size).columns >= 100 { table -e } else { table }" # run to display the output of a pipeline |
| 297 | command_not_found: { null } # return an error message when a command is not found |
| 298 | } |
| 299 | |
| 300 | menus: [ |
| 301 | # Configuration for default nushell menus |
| 302 | # Note the lack of source parameter |
| 303 | { |
| 304 | name: completion_menu |
| 305 | only_buffer_difference: false |
| 306 | marker: "| " |
| 307 | type: { |
| 308 | layout: columnar |
| 309 | columns: 4 |
| 310 | col_width: 20 # Optional value. If missing all the screen width is used to calculate column width |
| 311 | col_padding: 2 |
| 312 | } |
| 313 | style: { |
| 314 | text: green |
| 315 | selected_text: { attr: r } |
| 316 | description_text: yellow |
| 317 | match_text: { attr: u } |
| 318 | selected_match_text: { attr: ur } |
| 319 | } |
| 320 | } |
| 321 | { |
| 322 | name: ide_completion_menu |
| 323 | only_buffer_difference: false |
| 324 | marker: "| " |
| 325 | type: { |
| 326 | layout: ide |
| 327 | min_completion_width: 0, |
| 328 | max_completion_width: 50, |
| 329 | max_completion_height: 10, # will be limited by the available lines in the terminal |
| 330 | padding: 0, |
| 331 | border: true, |
| 332 | cursor_offset: 0, |
| 333 | description_mode: "prefer_right" |
| 334 | min_description_width: 0 |
| 335 | max_description_width: 50 |
| 336 | max_description_height: 10 |
| 337 | description_offset: 1 |
| 338 | # If true, the cursor pos will be corrected, so the suggestions match up with the typed text |
| 339 | # |
| 340 | # C:\> str |
| 341 | # str join |
| 342 | # str trim |
| 343 | # str split |
| 344 | correct_cursor_pos: false |
| 345 | } |
| 346 | style: { |
| 347 | text: green |
| 348 | selected_text: { attr: r } |
| 349 | description_text: yellow |
| 350 | match_text: { attr: u } |
| 351 | selected_match_text: { attr: ur } |
| 352 | } |
| 353 | } |
| 354 | { |
| 355 | name: history_menu |
| 356 | only_buffer_difference: true |
| 357 | marker: "? " |
| 358 | type: { |
| 359 | layout: list |
| 360 | page_size: 10 |
| 361 | } |
| 362 | style: { |
| 363 | text: green |
| 364 | selected_text: green_reverse |
| 365 | description_text: yellow |
| 366 | } |
| 367 | } |
| 368 | { |
| 369 | name: help_menu |
| 370 | only_buffer_difference: true |
| 371 | marker: "? " |
| 372 | type: { |
| 373 | layout: description |
| 374 | columns: 4 |
| 375 | col_width: 20 # Optional value. If missing all the screen width is used to calculate column width |
| 376 | col_padding: 2 |
| 377 | selection_rows: 4 |
| 378 | description_rows: 10 |
| 379 | } |
| 380 | style: { |
| 381 | text: green |
| 382 | selected_text: green_reverse |
| 383 | description_text: yellow |
| 384 | } |
| 385 | } |
| 386 | ] |
| 387 | |
| 388 | keybindings: [ |
| 389 | { |
| 390 | name: completion_menu |
| 391 | modifier: none |
| 392 | keycode: tab |
| 393 | mode: [emacs vi_normal vi_insert] |
| 394 | event: { |
| 395 | until: [ |
| 396 | { send: menu name: completion_menu } |
| 397 | { send: menunext } |
| 398 | { edit: complete } |
| 399 | ] |
| 400 | } |
| 401 | } |
| 402 | { |
| 403 | name: completion_previous_menu |
| 404 | modifier: shift |
| 405 | keycode: backtab |
| 406 | mode: [emacs, vi_normal, vi_insert] |
| 407 | event: { send: menuprevious } |
| 408 | } |
| 409 | { |
| 410 | name: ide_completion_menu |
| 411 | modifier: control |
| 412 | keycode: space |
| 413 | mode: [emacs vi_normal vi_insert] |
| 414 | event: { |
| 415 | until: [ |
| 416 | { send: menu name: ide_completion_menu } |
| 417 | { send: menunext } |
| 418 | { edit: complete } |
| 419 | ] |
| 420 | } |
| 421 | } |
| 422 | { |
| 423 | name: history_menu |
| 424 | modifier: control |
| 425 | keycode: char_r |
| 426 | mode: [emacs, vi_insert, vi_normal] |
| 427 | event: { send: menu name: history_menu } |
| 428 | } |
| 429 | { |
| 430 | name: help_menu |
| 431 | modifier: none |
| 432 | keycode: f1 |
| 433 | mode: [emacs, vi_insert, vi_normal] |
| 434 | event: { send: menu name: help_menu } |
| 435 | } |
| 436 | { |
| 437 | name: next_page_menu |
| 438 | modifier: control |
| 439 | keycode: char_x |
| 440 | mode: emacs |
| 441 | event: { send: menupagenext } |
| 442 | } |
| 443 | { |
| 444 | name: undo_or_previous_page_menu |
| 445 | modifier: control |
| 446 | keycode: char_z |
| 447 | mode: emacs |
| 448 | event: { |
| 449 | until: [ |
| 450 | { send: menupageprevious } |
| 451 | { edit: undo } |
| 452 | ] |
| 453 | } |
| 454 | } |
| 455 | { |
| 456 | name: escape |
| 457 | modifier: none |
| 458 | keycode: escape |
| 459 | mode: [emacs, vi_normal, vi_insert] |
| 460 | event: { send: esc } # NOTE: does not appear to work |
| 461 | } |
| 462 | { |
| 463 | name: cancel_command |
| 464 | modifier: control |
| 465 | keycode: char_c |
| 466 | mode: [emacs, vi_normal, vi_insert] |
| 467 | event: { send: ctrlc } |
| 468 | } |
| 469 | { |
| 470 | name: quit_shell |
| 471 | modifier: control |
| 472 | keycode: char_d |
| 473 | mode: [emacs, vi_normal, vi_insert] |
| 474 | event: { send: ctrld } |
| 475 | } |
| 476 | { |
| 477 | name: clear_screen |
| 478 | modifier: control |
| 479 | keycode: char_l |
| 480 | mode: [emacs, vi_normal, vi_insert] |
| 481 | event: { send: clearscreen } |
| 482 | } |
| 483 | { |
| 484 | name: search_history |
| 485 | modifier: control |
| 486 | keycode: char_q |
| 487 | mode: [emacs, vi_normal, vi_insert] |
| 488 | event: { send: searchhistory } |
| 489 | } |
| 490 | { |
| 491 | name: open_command_editor |
| 492 | modifier: control |
| 493 | keycode: char_o |
| 494 | mode: [emacs, vi_normal, vi_insert] |
| 495 | event: { send: openeditor } |
| 496 | } |
| 497 | { |
| 498 | name: move_up |
| 499 | modifier: none |
| 500 | keycode: up |
| 501 | mode: [emacs, vi_normal, vi_insert] |
| 502 | event: { |
| 503 | until: [ |
| 504 | { send: menuup } |
| 505 | { send: up } |
| 506 | ] |
| 507 | } |
| 508 | } |
| 509 | { |
| 510 | name: move_down |
| 511 | modifier: none |
| 512 | keycode: down |
| 513 | mode: [emacs, vi_normal, vi_insert] |
| 514 | event: { |
| 515 | until: [ |
| 516 | { send: menudown } |
| 517 | { send: down } |
| 518 | ] |
| 519 | } |
| 520 | } |
| 521 | { |
| 522 | name: move_left |
| 523 | modifier: none |
| 524 | keycode: left |
| 525 | mode: [emacs, vi_normal, vi_insert] |
| 526 | event: { |
| 527 | until: [ |
| 528 | { send: menuleft } |
| 529 | { send: left } |
| 530 | ] |
| 531 | } |
| 532 | } |
| 533 | { |
| 534 | name: move_right_or_take_history_hint |
| 535 | modifier: none |
| 536 | keycode: right |
| 537 | mode: [emacs, vi_normal, vi_insert] |
| 538 | event: { |
| 539 | until: [ |
| 540 | { send: historyhintcomplete } |
| 541 | { send: menuright } |
| 542 | { send: right } |
| 543 | ] |
| 544 | } |
| 545 | } |
| 546 | { |
| 547 | name: move_one_word_left |
| 548 | modifier: control |
| 549 | keycode: left |
| 550 | mode: [emacs, vi_normal, vi_insert] |
| 551 | event: { edit: movewordleft } |
| 552 | } |
| 553 | { |
| 554 | name: move_one_word_right_or_take_history_hint |
| 555 | modifier: control |
| 556 | keycode: right |
| 557 | mode: [emacs, vi_normal, vi_insert] |
| 558 | event: { |
| 559 | until: [ |
| 560 | { send: historyhintwordcomplete } |
| 561 | { edit: movewordright } |
| 562 | ] |
| 563 | } |
| 564 | } |
| 565 | { |
| 566 | name: move_to_line_start |
| 567 | modifier: none |
| 568 | keycode: home |
| 569 | mode: [emacs, vi_normal, vi_insert] |
| 570 | event: { edit: movetolinestart } |
| 571 | } |
| 572 | { |
| 573 | name: move_to_line_start |
| 574 | modifier: control |
| 575 | keycode: char_a |
| 576 | mode: [emacs, vi_normal, vi_insert] |
| 577 | event: { edit: movetolinestart } |
| 578 | } |
| 579 | { |
| 580 | name: move_to_line_end_or_take_history_hint |
| 581 | modifier: none |
| 582 | keycode: end |
| 583 | mode: [emacs, vi_normal, vi_insert] |
| 584 | event: { |
| 585 | until: [ |
| 586 | { send: historyhintcomplete } |
| 587 | { edit: movetolineend } |
| 588 | ] |
| 589 | } |
| 590 | } |
| 591 | { |
| 592 | name: move_to_line_end_or_take_history_hint |
| 593 | modifier: control |
| 594 | keycode: char_e |
| 595 | mode: [emacs, vi_normal, vi_insert] |
| 596 | event: { |
| 597 | until: [ |
| 598 | { send: historyhintcomplete } |
| 599 | { edit: movetolineend } |
| 600 | ] |
| 601 | } |
| 602 | } |
| 603 | { |
| 604 | name: move_to_line_start |
| 605 | modifier: control |
| 606 | keycode: home |
| 607 | mode: [emacs, vi_normal, vi_insert] |
| 608 | event: { edit: movetolinestart } |
| 609 | } |
| 610 | { |
| 611 | name: move_to_line_end |
| 612 | modifier: control |
| 613 | keycode: end |
| 614 | mode: [emacs, vi_normal, vi_insert] |
| 615 | event: { edit: movetolineend } |
| 616 | } |
| 617 | { |
| 618 | name: move_down |
| 619 | modifier: control |
| 620 | keycode: char_n |
| 621 | mode: [emacs, vi_normal, vi_insert] |
| 622 | event: { |
| 623 | until: [ |
| 624 | { send: menudown } |
| 625 | { send: down } |
| 626 | ] |
| 627 | } |
| 628 | } |
| 629 | { |
| 630 | name: move_up |
| 631 | modifier: control |
| 632 | keycode: char_p |
| 633 | mode: [emacs, vi_normal, vi_insert] |
| 634 | event: { |
| 635 | until: [ |
| 636 | { send: menuup } |
| 637 | { send: up } |
| 638 | ] |
| 639 | } |
| 640 | } |
| 641 | { |
| 642 | name: delete_one_character_backward |
| 643 | modifier: none |
| 644 | keycode: backspace |
| 645 | mode: [emacs, vi_insert] |
| 646 | event: { edit: backspace } |
| 647 | } |
| 648 | { |
| 649 | name: delete_one_word_backward |
| 650 | modifier: control |
| 651 | keycode: backspace |
| 652 | mode: [emacs, vi_insert] |
| 653 | event: { edit: backspaceword } |
| 654 | } |
| 655 | { |
| 656 | name: delete_one_character_forward |
| 657 | modifier: none |
| 658 | keycode: delete |
| 659 | mode: [emacs, vi_insert] |
| 660 | event: { edit: delete } |
| 661 | } |
| 662 | { |
| 663 | name: delete_one_character_forward |
| 664 | modifier: control |
| 665 | keycode: delete |
| 666 | mode: [emacs, vi_insert] |
| 667 | event: { edit: delete } |
| 668 | } |
| 669 | { |
| 670 | name: delete_one_character_backward |
| 671 | modifier: control |
| 672 | keycode: char_h |
| 673 | mode: [emacs, vi_insert] |
| 674 | event: { edit: backspace } |
| 675 | } |
| 676 | { |
| 677 | name: delete_one_word_backward |
| 678 | modifier: control |
| 679 | keycode: char_w |
| 680 | mode: [emacs, vi_insert] |
| 681 | event: { edit: backspaceword } |
| 682 | } |
| 683 | { |
| 684 | name: move_left |
| 685 | modifier: none |
| 686 | keycode: backspace |
| 687 | mode: vi_normal |
| 688 | event: { edit: moveleft } |
| 689 | } |
| 690 | { |
| 691 | name: newline_or_run_command |
| 692 | modifier: none |
| 693 | keycode: enter |
| 694 | mode: emacs |
| 695 | event: { send: enter } |
| 696 | } |
| 697 | { |
| 698 | name: move_left |
| 699 | modifier: control |
| 700 | keycode: char_b |
| 701 | mode: emacs |
| 702 | event: { |
| 703 | until: [ |
| 704 | { send: menuleft } |
| 705 | { send: left } |
| 706 | ] |
| 707 | } |
| 708 | } |
| 709 | { |
| 710 | name: move_right_or_take_history_hint |
| 711 | modifier: control |
| 712 | keycode: char_f |
| 713 | mode: emacs |
| 714 | event: { |
| 715 | until: [ |
| 716 | { send: historyhintcomplete } |
| 717 | { send: menuright } |
| 718 | { send: right } |
| 719 | ] |
| 720 | } |
| 721 | } |
| 722 | { |
| 723 | name: redo_change |
| 724 | modifier: control |
| 725 | keycode: char_g |
| 726 | mode: emacs |
| 727 | event: { edit: redo } |
| 728 | } |
| 729 | { |
| 730 | name: undo_change |
| 731 | modifier: control |
| 732 | keycode: char_z |
| 733 | mode: emacs |
| 734 | event: { edit: undo } |
| 735 | } |
| 736 | { |
| 737 | name: paste_before |
| 738 | modifier: control |
| 739 | keycode: char_y |
| 740 | mode: emacs |
| 741 | event: { edit: pastecutbufferbefore } |
| 742 | } |
| 743 | { |
| 744 | name: cut_word_left |
| 745 | modifier: control |
| 746 | keycode: char_w |
| 747 | mode: emacs |
| 748 | event: { edit: cutwordleft } |
| 749 | } |
| 750 | { |
| 751 | name: cut_line_to_end |
| 752 | modifier: control |
| 753 | keycode: char_k |
| 754 | mode: emacs |
| 755 | event: { edit: cuttolineend } |
| 756 | } |
| 757 | { |
| 758 | name: cut_line_from_start |
| 759 | modifier: control |
| 760 | keycode: char_u |
| 761 | mode: emacs |
| 762 | event: { edit: cutfromstart } |
| 763 | } |
| 764 | { |
| 765 | name: swap_graphemes |
| 766 | modifier: control |
| 767 | keycode: char_t |
| 768 | mode: emacs |
| 769 | event: { edit: swapgraphemes } |
| 770 | } |
| 771 | { |
| 772 | name: move_one_word_left |
| 773 | modifier: alt |
| 774 | keycode: left |
| 775 | mode: emacs |
| 776 | event: { edit: movewordleft } |
| 777 | } |
| 778 | { |
| 779 | name: move_one_word_right_or_take_history_hint |
| 780 | modifier: alt |
| 781 | keycode: right |
| 782 | mode: emacs |
| 783 | event: { |
| 784 | until: [ |
| 785 | { send: historyhintwordcomplete } |
| 786 | { edit: movewordright } |
| 787 | ] |
| 788 | } |
| 789 | } |
| 790 | { |
| 791 | name: move_one_word_left |
| 792 | modifier: alt |
| 793 | keycode: char_b |
| 794 | mode: emacs |
| 795 | event: { edit: movewordleft } |
| 796 | } |
| 797 | { |
| 798 | name: move_one_word_right_or_take_history_hint |
| 799 | modifier: alt |
| 800 | keycode: char_f |
| 801 | mode: emacs |
| 802 | event: { |
| 803 | until: [ |
| 804 | { send: historyhintwordcomplete } |
| 805 | { edit: movewordright } |
| 806 | ] |
| 807 | } |
| 808 | } |
| 809 | { |
| 810 | name: delete_one_word_forward |
| 811 | modifier: alt |
| 812 | keycode: delete |
| 813 | mode: emacs |
| 814 | event: { edit: deleteword } |
| 815 | } |
| 816 | { |
| 817 | name: delete_one_word_backward |
| 818 | modifier: alt |
| 819 | keycode: backspace |
| 820 | mode: emacs |
| 821 | event: { edit: backspaceword } |
| 822 | } |
| 823 | { |
| 824 | name: delete_one_word_backward |
| 825 | modifier: alt |
| 826 | keycode: char_m |
| 827 | mode: emacs |
| 828 | event: { edit: backspaceword } |
| 829 | } |
| 830 | { |
| 831 | name: cut_word_to_right |
| 832 | modifier: alt |
| 833 | keycode: char_d |
| 834 | mode: emacs |
| 835 | event: { edit: cutwordright } |
| 836 | } |
| 837 | { |
| 838 | name: upper_case_word |
| 839 | modifier: alt |
| 840 | keycode: char_u |
| 841 | mode: emacs |
| 842 | event: { edit: uppercaseword } |
| 843 | } |
| 844 | { |
| 845 | name: lower_case_word |
| 846 | modifier: alt |
| 847 | keycode: char_l |
| 848 | mode: emacs |
| 849 | event: { edit: lowercaseword } |
| 850 | } |
| 851 | { |
| 852 | name: capitalize_char |
| 853 | modifier: alt |
| 854 | keycode: char_c |
| 855 | mode: emacs |
| 856 | event: { edit: capitalizechar } |
| 857 | } |
| 858 | # The following bindings with `*system` events require that Nushell has |
| 859 | # been compiled with the `system-clipboard` feature. |
| 860 | # If you want to use the system clipboard for visual selection or to |
| 861 | # paste directly, uncomment the respective lines and replace the version |
| 862 | # using the internal clipboard. |
| 863 | { |
| 864 | name: copy_selection |
| 865 | modifier: control_shift |
| 866 | keycode: char_c |
| 867 | mode: emacs |
| 868 | event: { edit: copyselection } |
| 869 | # event: { edit: copyselectionsystem } |
| 870 | } |
| 871 | { |
| 872 | name: cut_selection |
| 873 | modifier: control_shift |
| 874 | keycode: char_x |
| 875 | mode: emacs |
| 876 | event: { edit: cutselection } |
| 877 | # event: { edit: cutselectionsystem } |
| 878 | } |
| 879 | # { |
| 880 | # name: paste_system |
| 881 | # modifier: control_shift |
| 882 | # keycode: char_v |
| 883 | # mode: emacs |
| 884 | # event: { edit: pastesystem } |
| 885 | # } |
| 886 | { |
| 887 | name: select_all |
| 888 | modifier: control_shift |
| 889 | keycode: char_a |
| 890 | mode: emacs |
| 891 | event: { edit: selectall } |
| 892 | } |
| 893 | ] |
| 894 | } |
| 895 | |
| 896 | $env.config.hooks.env_change.PWD = [...$env.config.hooks.env_change.PWD |
| 897 | { |_, after| |
| 898 | if (($after | path join .node-version | path exists) or ($after | path join .nvmrc | path exists)) { |
| 899 | fnm use --silent-if-unchanged |
| 900 | } |
| 901 | }] |
| 902 | |
| 903 | def tsi [parser: string] { |
| 904 | let tree = $"($env.HOME)/.local/share/nvim/site" |
| 905 | luarocks --lua-version=5.1 $"--tree=($tree)" install $"tree-sitter-($parser)" |
| 906 | } |
| 907 | |
| 908 | # Function to open sesh |
| 909 | def t [] { |
| 910 | let selected = (sesh list -i | gum filter --limit 1 --placeholder "Choose a session" --height 50 --prompt="> " --indicator.foreground="2" --match.foreground="2") |
| 911 | if ($selected | is-empty) { |
| 912 | echo "No session selected" |
| 913 | } else { |
| 914 | sesh connect $selected |
| 915 | } |
| 916 | } |
| 917 | |
| 918 | def nvimf [] { |
| 919 | let file = (fd --type f --hidden --exclude .git | fzf --preview "bat --color=always {}") |
| 920 | if ($file | is-empty) { |
| 921 | echo "No file selected" |
| 922 | } else { |
| 923 | nvim $file |
| 924 | } |
| 925 | } |
| 926 | |
| 927 | |
| 928 | def ns [] { |
| 929 | rm -f ~/.nvim-startup.txt |
| 930 | nvim --headless --startuptime ~/.nvim-startup.txt +qa |
| 931 | grep "NVIM STARTED" ~/.nvim-startup.txt |
| 932 | } |
| 933 | |
| 934 | def nh [] { |
| 935 | rm -f ~/.nvim-startup.txt |
| 936 | nvim --headless --startuptime ~/.nvim-startup.txt +qa |
| 937 | bat ~/.nvim-startup.txt |
| 938 | } |
| 939 | |
| 940 | def cpf [file_path: string] { |
| 941 | cat ($file_path) | pbcopy |
| 942 | echo "✔︎ Copied to clipboard!" |
| 943 | } |
| 944 | |
| 945 | def orbiter-personal [] { |
| 946 | gum spin --spinner dot --spinner.foreground="2" --title "Updating..." -- orbiter auth --key (op read "op://Personal/orbiter-api-key/credential") |
| 947 | let check = (gum style --foreground="2" "✓ "); |
| 948 | gum join $check "Orbiter key set to personal!" |
| 949 | |
| 950 | } |
| 951 | |
| 952 | def orbiter-account [] { |
| 953 | gum spin --spinner dot --spinner.foreground="2" --title "Updating..." -- orbiter auth --key (op read "op://Personal/orbiter-account-api-key/credential") |
| 954 | let check = (gum style --foreground="2" "✓ "); |
| 955 | gum join $check "Orbiter key set to Orbiter account!" |
| 956 | } |
| 957 | |
| 958 | # Custom git init with .gitignore template |
| 959 | def ginit [ |
| 960 | --template (-t): string = "node,macos,linux,windows" # The template to use for .gitignore, comma separated values |
| 961 | ] { |
| 962 | git init |
| 963 | echo $"Fetching .gitignore template for ($template)..." |
| 964 | curl -sL $"https://www.toptal.com/developers/gitignore/api/($template)" | save .gitignore |
| 965 | git add .gitignore |
| 966 | echo "Repository initialized with .gitignore template!" |
| 967 | } |
| 968 | |
| 969 | def blogdate [] { |
| 970 | date now | date to-timezone UTC | format date "%Y-%m-%dT%H:%M:%SZ" |
| 971 | } |
| 972 | |
| 973 | alias ll = ls -l |
| 974 | alias la = ls -a |
| 975 | alias lg = lazygit |
| 976 | alias nf = neofetch |
| 977 | alias fl = fastfetch -c ~/.config/fastfetch/presets/examples/8.jsonc |
| 978 | alias ff = fastfetch -c ~/.config/fastfetch/presets/examples/20.jsonc |
| 979 | alias nvimrc = nvim ~/.config/nvim |
| 980 | alias shitter = ssh itter |
| 981 | alias tailscale = /Applications/Tailscale.app/Contents/MacOS/Tailscale |
| 982 | alias ai = aichat |
| 983 | alias system = macchina |
| 984 | alias bonsai = cbonsai -li -t 0.4 |
| 985 | alias lst = lstr --icons --color=always --size |
| 986 | alias keys = keysmasher |
| 987 | |
| 988 | mkdir ($nu.data-dir | path join "vendor/autoload") |
| 989 | starship init nu | save -f ($nu.data-dir | path join "vendor/autoload/starship.nu") |
| 990 | source ~/.config/nushell/zoxide.nu |
| 991 | source ~/.cargo/env.nu |