From ee6519f5cbe5f072c7a4f3a229281d9d52424b25 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Sun, 24 Mar 2024 22:32:30 +0100 Subject: [PATCH 1/2] Autocomplete `unknown` value in `set filetype ...` `unknown` is a valid value for the `filetype` option (and executing `set filetype unknown` does what is expected: it forces filetype autodetection). So let's add `unknown` to the autocomplete suggestions for `filetype`, along with actual filetypes. --- internal/action/infocomplete.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/action/infocomplete.go b/internal/action/infocomplete.go index ee2e27e7..67b6671c 100644 --- a/internal/action/infocomplete.go +++ b/internal/action/infocomplete.go @@ -87,6 +87,10 @@ func filetypeComplete(input string) (string, []string) { } } + if strings.HasPrefix("unknown", input) { + suggestions = append(suggestions, "unknown") + } + var chosen string if len(suggestions) == 1 { chosen = suggestions[0] From d64c9443f5f7f94133297b3a34ee0e9a892f1ec8 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Mon, 25 Mar 2024 03:25:13 +0100 Subject: [PATCH 2/2] Autocomplete `off` value as well It is also a documented special value of the `filetype` option. --- internal/action/infocomplete.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/action/infocomplete.go b/internal/action/infocomplete.go index 67b6671c..11e60918 100644 --- a/internal/action/infocomplete.go +++ b/internal/action/infocomplete.go @@ -87,6 +87,9 @@ func filetypeComplete(input string) (string, []string) { } } + if strings.HasPrefix("off", input) { + suggestions = append(suggestions, "off") + } if strings.HasPrefix("unknown", input) { suggestions = append(suggestions, "unknown") }