diff --git a/home/apps/nu.nix b/home/apps/nu.nix index cab5540..483898e 100644 --- a/home/apps/nu.nix +++ b/home/apps/nu.nix @@ -46,6 +46,11 @@ let filename = "yarn-v4"; } ]; + + command-not-found = pkgs.writeShellScript "command-not-found" '' + source ${config.programs.nix-index.package}/etc/profile.d/command-not-found.sh + command_not_found_handle "$@" + ''; in { home.packages = [ pkgs.carapace ]; @@ -56,6 +61,12 @@ in extraConfig = '' + $env.config = ($env.config? | default {}) + $env.config.hooks = ($env.config.hooks? | default {}) + $env.config.hooks.command_not_found = { + |cmd_name| (try { ${command-not-found} $cmd_name }) + } + source ${plugins}/aliases/git/git-aliases.nu '' + shellAliases diff --git a/home/apps/nu/config.nu b/home/apps/nu/config.nu index 14c47e1..e1b3476 100644 --- a/home/apps/nu/config.nu +++ b/home/apps/nu/config.nu @@ -14,14 +14,11 @@ $env.config = { show_banner: false ls: { - # use the LS_COLORS environment variable to colorize output use_ls_colors: true - # enable or disable clickable links. Your terminal has to support links. clickable_links: true } rm: { - # always act as if -t was given. Can be overridden with -p always_trash: false } @@ -35,31 +32,20 @@ $env.config = { # a left right padding of each column in a table padding: { left: 1, right: 1 } trim: { - # `wrapping` or `truncating` - methodology: truncating - # A strategy used by the 'wrapping' methodology - wrapping_try_keep_words: true - # A suffix used by the 'truncating' methodology + methodology: truncating # `wrapping` or `truncating` truncating_suffix: "…" } # show header text on separator/border line header_on_separator: false - # limit data rows from top and bottom after reaching a set point # abbreviated_row_count: 10 } - error_style: "fancy" # "fancy" or "plain" for screen reader-friendly error messages + error_style: fancy - # datetime_format determines what a datetime rendered in the shell would look like. - # Behavior without this configuration point will be to "humanize" the datetime display, - # showing something like "a day ago." datetime_format: { - # shows up in displays of variables or other datetime's outside of tables - # normal: '%a, %d %b %Y %H:%M:%S %z' - - # generally shows up in tabular outputs such as ls. commenting this out will change it to the default human readable datetime format - table: '%Y-%m-%d %I:%M:%S%p' + normal: "%Y-%m-%d %I:%M:%S%p" + table: "%Y-%m-%d %I:%M:%S%p" } explore: { @@ -80,31 +66,20 @@ $env.config = { } history: { - # Session has to be reloaded for this to take effect max_size: 100_000 - # Enable to share history between multiple sessions, else you have to close the session to write history to file sync_on_enter: true - # "sqlite" or "plaintext" file_format: "plaintext" - # 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. isolation: false } completions: { - # set to true to enable case-sensitive completions case_sensitive: false - # set this to false to prevent auto-selecting completions when only one remains quick: true - # set this to false to prevent partial filling of the prompt partial: true - # prefix or fuzzy algorithm: "prefix" external: { - # 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 enable: true - # setting it lower can improve completion performance at the cost of omitting some options - max_results: 100 - # check 'carapace_completer' above as an example + max_results: 50 completer: $carapace_completer } use_ls_colors: true # set this to true to enable file/path/directory completions using LS_COLORS @@ -171,10 +146,10 @@ $env.config = { marker: "| " type: { layout: columnar - columns: 4 + columns: 1 # Optional value. If missing all the screen width is used to calculate column width - col_width: 20 - col_padding: 2 + # col_width: 20 + # col_padding: 2 } style: { text: green @@ -217,38 +192,6 @@ $env.config = { selected_match_text: { attr: ur } } } - { - name: history_menu - only_buffer_difference: true - marker: "? " - type: { - layout: list - page_size: 10 - } - style: { - text: green - selected_text: green_reverse - description_text: yellow - } - } - { - name: help_menu - only_buffer_difference: true - marker: "? " - type: { - layout: description - columns: 4 - col_width: 20 # Optional value. If missing all the screen width is used to calculate column width - col_padding: 2 - selection_rows: 4 - description_rows: 10 - } - style: { - text: green - selected_text: green_reverse - description_text: yellow - } - } ] keybindings: (keybindings) } diff --git a/home/apps/nu/config/keybindings.nu b/home/apps/nu/config/keybindings.nu index e8b6089..c8ef7a0 100644 --- a/home/apps/nu/config/keybindings.nu +++ b/home/apps/nu/config/keybindings.nu @@ -26,21 +26,6 @@ export def main [] { ] } } - # replaced by Atuin.sh - # { - # name: history_menu - # modifier: control - # keycode: char_r - # mode: [vi_insert, vi_normal] - # event: { send: menu name: history_menu } - # } - { - name: help_menu - modifier: none - keycode: f1 - mode: [vi_insert, vi_normal] - event: { send: menu name: help_menu } - } { name: completion_previous_menu modifier: shift @@ -179,10 +164,10 @@ export def main [] { keycode: end mode: [vi_normal, vi_insert] event: { - until: [ - { send: historyhintcomplete } - { edit: movetolineend } - ] + until: [ + { send: historyhintcomplete } + { edit: movetolineend } + ] } } { @@ -191,10 +176,10 @@ export def main [] { keycode: char_e mode: [vi_normal, vi_insert] event: { - until: [ - { send: historyhintcomplete } - { edit: movetolineend } - ] + until: [ + { send: historyhintcomplete } + { edit: movetolineend } + ] } } {