From 0a8b2fafbd3c3b2891b3693b2891c69872c531ef Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Thu, 22 Dec 2022 14:38:34 +0100 Subject: [PATCH] Document the priority option in shell-script-candidates/completions --- doc/pages/commands.asciidoc | 11 +++++++++++ doc/pages/options.asciidoc | 9 ++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/doc/pages/commands.asciidoc b/doc/pages/commands.asciidoc index 5b158ef838..66d4857625 100644 --- a/doc/pages/commands.asciidoc +++ b/doc/pages/commands.asciidoc @@ -482,6 +482,7 @@ New commands can be defined using the *define-command* command: define the documentation string for the command *-menu*::: + *-priority*::: *-file-completion*::: *-client-completion*::: *-buffer-completion*::: @@ -517,6 +518,9 @@ Command completion can be configured with the *complete-command* command: permitted parameters. Kakoune will autoselect the best completion candidate on command validation. + *-priority*::: + see `shell-script-candidates`. + *completion_type* can be: *file*::: @@ -557,6 +561,13 @@ Command completion can be configured with the *complete-command* command: completion session, candidates are cached and then used by kakoune internal fuzzy engine. + If the `-priority` switch is specified, shell script output lines + must match `|`. In this case, any `|` or `\` + characters that occur within the `` field, should be + escaped as `\|` or `\\`. The priority field is a positive integer + to sort completions (lower is better), same as in the `completions` + type in <>. + During the execution of the shell script, the following env vars are available: diff --git a/doc/pages/options.asciidoc b/doc/pages/options.asciidoc index b275d9c68c..9ef0818ff0 100644 --- a/doc/pages/options.asciidoc +++ b/doc/pages/options.asciidoc @@ -142,7 +142,7 @@ are exclusively available to built-in options. escaped as `\|` or `\\`. *completions*:: - a list of `||[|]` candidates, except for the first element which follows the `.[+]@` format to define where the completion apply in the buffer. @@ -152,8 +152,11 @@ are exclusively available to built-in options. Options of this type are are meant to be added to the `completers` option to provide insert mode completion. Candidates are shown if the - text typed by the user (between `.` and the cursor) is a - subsequence of ``. + query typed by the user (the text between `.` and the + cursor) is a subsequence of ``. Candidates are sorted by how well + they match the query - by length of matching subsequences and number + of matched word boundaries (higher is better) as well as the optional + `` field, which is a positive integer (lower is better). For each remaining candidate, the completion menu displays ``, followed by ``, which is a Markup string (see