Merge remote-tracking branch 'Delapouite/complete-line'
This commit is contained in:
commit
8900d06646
|
@ -982,6 +982,7 @@ Some options are built in Kakoune, and can be used to control its behaviour:
|
|||
(`word=all`) or only the current one (`word=buffer`)
|
||||
- `filename` which tries to detect when a filename is being entered and
|
||||
provides completion based on local filesystem.
|
||||
- `line` which complete using lines in current buffer
|
||||
- `option=<opt-name>` where <opt-name> is a _completions_ option.
|
||||
* `static_words` _str-list_: list of words that are always added to completion
|
||||
candidates when completing words in insert mode.
|
||||
|
|
|
@ -129,6 +129,9 @@ Builtin options
|
|||
which tries to detect when a filename is being entered and
|
||||
provides completion based on local filesystem
|
||||
|
||||
*line*:::
|
||||
which complete using lines in current buffer
|
||||
|
||||
*option=<opt-name>*:::
|
||||
where *opt-name* is an option of type 'completions' whose
|
||||
contents will be used
|
||||
|
|
|
@ -32,6 +32,8 @@ String option_to_string(const InsertCompleterDesc& opt)
|
|||
return "filename";
|
||||
case InsertCompleterDesc::Option:
|
||||
return "option=" + (opt.param ? *opt.param : "");
|
||||
case InsertCompleterDesc::Line:
|
||||
return "line";
|
||||
}
|
||||
kak_assert(false);
|
||||
return "";
|
||||
|
@ -61,6 +63,12 @@ void option_from_string(StringView str, InsertCompleterDesc& opt)
|
|||
opt.param = Optional<String>{};
|
||||
return;
|
||||
}
|
||||
else if (str == "line")
|
||||
{
|
||||
opt.mode = InsertCompleterDesc::Line;
|
||||
opt.param = Optional<String>{};
|
||||
return;
|
||||
}
|
||||
throw runtime_error(format("invalid completer description: '{}'", str));
|
||||
}
|
||||
|
||||
|
@ -467,6 +475,9 @@ bool InsertCompleter::setup_ifn()
|
|||
*completer.param == "all" and
|
||||
try_complete(complete_word<true>))
|
||||
return true;
|
||||
if (completer.mode == InsertCompleterDesc::Line and
|
||||
try_complete(complete_line))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@ struct InsertCompleterDesc
|
|||
{
|
||||
Word,
|
||||
Option,
|
||||
Filename
|
||||
Filename,
|
||||
Line
|
||||
};
|
||||
|
||||
bool operator==(const InsertCompleterDesc& other) const
|
||||
|
|
Loading…
Reference in New Issue
Block a user