ulyssa / modalkit

A Rust library for building modal editing applications
Apache License 2.0
57 stars 8 forks source link

Support text completion #29

Closed ulyssa closed 1 year ago

ulyssa commented 2 years ago

There's an Action for completing text, Complete, but nothing to use it with at the moment. It would be nice if there were a way for consumers to provide code for determining completions given a prefix, to provide application-contextual choices (e.g., complete a username or room alias in iamb). There should also be a way to gather words from a buffer and offer those as options.

There are several different styles for display text completion options in Vim: ^N/^P in Insert mode to show and navigate a menu, replacing the word at each step, <Tab>/<S-Tab> in Command mode to replace the word with the options, and ^D in Command mode to show a multi-column list of completions without actually replacing the text with any of them. To avoid pushing figuring out how to render the overlay menu onto consumers, Screen should probably handle displaying completions, at least by default.