mirror of
https://github.com/Hopiu/micro.git
synced 2026-04-13 19:10:58 +00:00
Add colorscheme complete function
This function is not used at the moment.
This commit is contained in:
parent
043f7cdc47
commit
5024ecd640
1 changed files with 19 additions and 0 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue