From 9f1c1b8e3964aff260f5553378d4b1b536394c9c Mon Sep 17 00:00:00 2001 From: Suyashtnt Date: Sat, 8 Jun 2024 23:09:43 +0200 Subject: [PATCH] feat: enable nushell IDE completion --- users/modules/nushell/config/config.nu | 90 ++++++++++++++++---------- 1 file changed, 56 insertions(+), 34 deletions(-) diff --git a/users/modules/nushell/config/config.nu b/users/modules/nushell/config/config.nu index 66058a6..030ff21 100644 --- a/users/modules/nushell/config/config.nu +++ b/users/modules/nushell/config/config.nu @@ -220,30 +220,39 @@ $env.config = { description_text: yellow } } - # { - # name: ide_completion_menu - # only_buffer_difference: false - # marker: "| " - # type: { - # layout: ide - # min_completion_width: 0, - # max_completion_width: 50, - # # max_completion_height: 10, # will be limited by the available lines in the terminal - # padding: 0, - # border: false, - # cursor_offset: 0, - # description_mode: "prefer_right" - # min_description_width: 0 - # max_description_width: 50 - # max_description_height: 10 - # description_offset: 1 - # } - # style: { - # text: green - # selected_text: green_reverse - # description_text: yellow - # } - # } + { + name: ide_completion_menu + only_buffer_difference: false + marker: "| " + type: { + layout: ide + min_completion_width: 0, + max_completion_width: 50, + max_completion_height: 10, # will be limited by the available lines in the terminal + padding: 0, + border: true, + cursor_offset: 0, + description_mode: "prefer_right" + min_description_width: 0 + max_description_width: 50 + max_description_height: 10 + description_offset: 1 + # If true, the cursor pos will be corrected, so the suggestions match up with the typed text + # + # C:\> str + # str join + # str trim + # str split + correct_cursor_pos: false + } + style: { + text: green + selected_text: { attr: r } + description_text: yellow + match_text: { attr: u } + selected_match_text: { attr: ur } + } + } { name: history_menu only_buffer_difference: true @@ -359,17 +368,30 @@ $env.config = { ] keybindings: [ { - name: completion_menu - modifier: none - keycode: tab - mode: [emacs vi_normal vi_insert] - event: { - until: [ - { send: menu name: completion_menu } - { send: menunext } - ] - } + name: ide_completion_menu + modifier: none + keycode: tab + mode: [emacs vi_normal vi_insert] + event: { + until: [ + { send: menu name: ide_completion_menu } + { send: menunext } + { edit: complete } + ] + } } + # { + # name: completion_menu + # modifier: none + # keycode: tab + # mode: [emacs vi_normal vi_insert] + # event: { + # until: [ + # { send: menu name: completion_menu } + # { send: menunext } + # ] + # } + # } { name: completion_previous modifier: shift