From 5024ecd64090a88336c2dceadc14cf878eafef53 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Thu, 23 Feb 2017 16:32:33 -0500 Subject: [PATCH] Add colorscheme complete function This function is not used at the moment. --- cmd/micro/autocomplete.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cmd/micro/autocomplete.go b/cmd/micro/autocomplete.go index b1557e07..8cf96e29 100644 --- a/cmd/micro/autocomplete.go +++ b/cmd/micro/autocomplete.go @@ -98,6 +98,25 @@ func HelpComplete(input string) (string, []string) { return chosen, suggestions } +// ColorschemeComplete tab-completes names of colorschemes. +func ColorschemeComplete(input string) (string, []string) { + var suggestions []string + files := ListRuntimeFiles(RTColorscheme) + + for _, f := range files { + if strings.HasPrefix(f.Name(), input) { + suggestions = append(suggestions, f.Name()) + } + } + + var chosen string + if len(suggestions) == 1 { + chosen = suggestions[0] + } + + return chosen, suggestions +} + func contains(s []string, e string) bool { for _, a := range s { if a == e {