Like most parts of Hilbish, it’s made to be extensible and customizable. The default handler for completions in general can be overwritten to provide more advanced completions if needed.
Completion Handler By default, it provides 3 things: for the first argument, binaries (with a plain name requested to complete, those in $PATH), files, or command completions." property="og:description"><metacontent="Hilbishhasaprettygoodcompletionsystem.Ithasanicelookingmenu,with2typesofmenus:grid(likefilecompletions)orlist.
Like most parts of Hilbish, it’s made to be extensible and customizable. The default handler for completions in general can be overwritten to provide more advanced completions if needed.
<emclass=text-muted>by <strong>sammyette</strong></em><divclass=my-4><p>Hilbish has a pretty good completion system. It has a nice looking
menu, with 2 types of menus: grid (like file completions) or
list.</p><p>Like most parts of Hilbish, it’s made to be extensible and
customizable. The default handler for completions in general can
be overwritten to provide more advanced completions if needed.</p><h2id=completion-handlerclass=heading>Completion Handler
<ahref=#completion-handlerclass=heading-link><iclass="fas fa-paperclip"></i></a></h2><p>By default, it provides 3 things: for the first argument,
binaries (with a plain name requested to complete, those in
$PATH), files, or command completions. With the default
completion handler, it will try to run a handler for the
command or fallback to file completions.</p><p>To overwrite it, just assign a function to
<code>hilbish.completion.handler</code> like so:
function hilbish.completion.handler(line, pos)
– do things
end</p><p>It is passed 2 arguments, the entire line, and the current
cursor position. The functions in the completion interface
take 3 arguments: query, ctx, and fields.</p><ul><li>The <code>query</code>, which what the user is currently trying to complete</li><li><code>ctx</code>, being just the entire line</li><li><code>fields</code> being a table of arguments. It’s just <code>ctx</code> split up,
delimited by spaces.</li></ul><p>It’s expected to return 2 things: a table of completion groups, and
a prefix. A completion group is defined as a table with 2 keys:
<code>items</code> and <code>type</code>.</p><ul><li>The <code>items</code> field is just a table of items to use for completions.</li><li>The <code>type</code> is for the completion menu type, being either <code>grid</code> or
<code>list</code>.</li></ul><p>The prefix is what all the completions start with. It should be empty
if the user doesn’t have a query. If the beginning of the completion
item does not match the prefix, it will be replaced and fixed
properly in the line. It is case sensitive.</p><p>If you want to overwrite the functionality of the general completion
handler, or make your command completion have files as well
(and filter them), then there is the <code>files</code> function, which is