Show local executables for kityt command completion even without ./

This commit is contained in:
Kovid Goyal 2022-09-19 19:47:18 +05:30
parent 454c2e32e7
commit 7cf9b21fc0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 3 additions and 2 deletions

View File

@ -31,7 +31,7 @@ func complete_kitty(completions *Completions, word string, arg_num int) {
}
}
if len(word) > 0 && (filepath.IsAbs(word) || strings.HasPrefix(word, "./") || strings.HasPrefix(word, "~")) {
if len(word) > 0 {
mg := completions.add_match_group("Executables")
mg.IsFiles = true

View File

@ -76,7 +76,6 @@ func fmt_desc(word, desc string, max_word_len int, f *markup.Context, screen_wid
}
func serialize(completions *Completions, f *markup.Context, screen_width int) ([]byte, error) {
cmd := strings.Builder{}
output := strings.Builder{}
if completions.Delegate.NumToRemove > 0 {
for i := 0; i < completions.Delegate.NumToRemove; i++ {
@ -87,6 +86,7 @@ func serialize(completions *Completions, f *markup.Context, screen_width int) ([
return []byte(output.String()), nil
}
for _, mg := range completions.Groups {
cmd := strings.Builder{}
cmd.WriteString("compadd -U -J ")
cmd.WriteString(utils.QuoteStringForSH(mg.Title))
cmd.WriteString(" -X ")
@ -118,6 +118,7 @@ func serialize(completions *Completions, f *markup.Context, screen_width int) ([
}
fmt.Fprintln(&output, cmd.String(), ";")
}
// debugf("%#v", output.String())
return []byte(output.String()), nil
}