From 5729a92b6c6bd96244e0510198e148833aa4163c Mon Sep 17 00:00:00 2001 From: bogzbonny Date: Thu, 25 Sep 2025 10:55:50 -0700 Subject: [PATCH 1/3] basic options for enabled or disabled filetypes --- README.md | 2 ++ autoload/tabby/inline_completion/service.vim | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/README.md b/README.md index 4479651..a607d6b 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,8 @@ Here is a table of all configuration variables that can be set when the Tabby pl | `g:tabby_inline_completion_keybinding_accept` | `""` | The keybinding to accept the inline completion | | `g:tabby_inline_completion_keybinding_trigger_or_dismiss` | `""` | The keybinding to trigger or dismiss the inline completion | | `g:tabby_inline_completion_insertion_leading_key` | `"\\="` | The leading key sequence to insert the inline completion text | +| `g:tabby_disabled_filetypes` | `[]` | List of filetypes for which Tabby suggestions are disabled | +| `g:tabby_disable_all_except_filetypes` | `[]` | List of filetypes to enable Tabby for; when non‑empty, all other filetypes are disabled | ## Contributing diff --git a/autoload/tabby/inline_completion/service.vim b/autoload/tabby/inline_completion/service.vim index d70ed0a..2f00c5e 100644 --- a/autoload/tabby/inline_completion/service.vim +++ b/autoload/tabby/inline_completion/service.vim @@ -6,6 +6,14 @@ let g:autoloaded_tabby_inline_completion_service = 1 let g:tabby_inline_completion_trigger = get(g:, 'tabby_inline_completion_trigger', 'auto') let g:tabby_inline_completion_insertion_leading_key = get(g:, 'tabby_inline_completion_insertion_leading_key', "\\=") +" List of filetypes for which tabby suggestions are disabled. +let g:tabby_disabled_filetypes = get(g:, 'tabby_disabled_filetypes', []) + +" List of filetypes for which tabby suggestions are enabled when the +" "disable all except" mode is active. If non‑empty, all other filetypes are +" automatically disabled. +let g:tabby_disable_all_except_filetypes = get(g:, 'tabby_disable_all_except_filetypes', []) + let s:current_request_context = {} let s:current_request_id = 0 @@ -35,6 +43,14 @@ function! tabby#inline_completion#service#Trigger(is_manually) if g:tabby_inline_completion_trigger != 'auto' && !a:is_manually return endif + " Do not trigger for disabled filetypes + if index(g:tabby_disabled_filetypes, &filetype) >= 0 + return + endif + " When "disable all except" list is non‑empty, only allow those filetypes + if len(g:tabby_disable_all_except_filetypes) > 0 && index(g:tabby_disable_all_except_filetypes, &filetype) < 0 + return + endif let params = s:CreateInlineCompletionContext(a:is_manually) let s:current_request_context = params let OnResponse = { result -> s:HandleCompletionResponse(params, result) } From 361037d62841d2027f67d0d7476ee541924a914f Mon Sep 17 00:00:00 2001 From: bogzbonny Date: Thu, 25 Sep 2025 11:26:33 -0700 Subject: [PATCH 2/3] cleanup --- autoload/tabby/inline_completion/service.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autoload/tabby/inline_completion/service.vim b/autoload/tabby/inline_completion/service.vim index 2f00c5e..0038eab 100644 --- a/autoload/tabby/inline_completion/service.vim +++ b/autoload/tabby/inline_completion/service.vim @@ -43,14 +43,17 @@ function! tabby#inline_completion#service#Trigger(is_manually) if g:tabby_inline_completion_trigger != 'auto' && !a:is_manually return endif + " Do not trigger for disabled filetypes if index(g:tabby_disabled_filetypes, &filetype) >= 0 return endif + " When "disable all except" list is non‑empty, only allow those filetypes - if len(g:tabby_disable_all_except_filetypes) > 0 && index(g:tabby_disable_all_except_filetypes, &filetype) < 0 + if len(g:tabby_disable_all_except_filetypes) > 0 && index(g:tabby_disable_all_except_filetypes, &filetype) == -1 return endif + let params = s:CreateInlineCompletionContext(a:is_manually) let s:current_request_context = params let OnResponse = { result -> s:HandleCompletionResponse(params, result) } From c1d866e0b9d140ea8fb852d4a153d360462d623c Mon Sep 17 00:00:00 2001 From: bogzbonny Date: Thu, 25 Sep 2025 11:33:34 -0700 Subject: [PATCH 3/3] examples in README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a607d6b..96e5739 100644 --- a/README.md +++ b/README.md @@ -91,8 +91,8 @@ Here is a table of all configuration variables that can be set when the Tabby pl | `g:tabby_inline_completion_keybinding_accept` | `""` | The keybinding to accept the inline completion | | `g:tabby_inline_completion_keybinding_trigger_or_dismiss` | `""` | The keybinding to trigger or dismiss the inline completion | | `g:tabby_inline_completion_insertion_leading_key` | `"\\="` | The leading key sequence to insert the inline completion text | -| `g:tabby_disabled_filetypes` | `[]` | List of filetypes for which Tabby suggestions are disabled | -| `g:tabby_disable_all_except_filetypes` | `[]` | List of filetypes to enable Tabby for; when non‑empty, all other filetypes are disabled | +| `g:tabby_disabled_filetypes` | `[]` | List of filetypes for which Tabby suggestions are disabled (eg. ['markdown', 'toml'])| +| `g:tabby_disable_all_except_filetypes` | `[]` | List of filetypes to enable Tabby for; when non‑empty, all other filetypes are disabled (eg. ['rust'])| ## Contributing