diff options
| author | Maxime Coste <mawww@kakoune.org> | 2021-10-29 08:20:08 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2021-10-29 08:20:08 +1100 |
| commit | be4659097c06b3353961cef309448e2cf572cd9a (patch) | |
| tree | 6051780377a65878f416859c3bbb5bbe69891958 /src | |
| parent | 874f3e07641b4d941c8b01f3180228311700ef52 (diff) | |
Complete alias command with existing alias names
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/commands.cc b/src/commands.cc index 4f65e600..9366466a 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -206,6 +206,14 @@ static Completions complete_command_name(const Context& context, CompletionFlags context, prefix.substr(0, cursor_pos)); } +static Completions complete_alias_name(const Context& context, CompletionFlags, + const String& prefix, ByteCount cursor_pos) +{ + return { 0_byte, cursor_pos, complete(prefix, cursor_pos, + context.aliases().flatten_aliases() + | transform(&HashItem<String, String>::key)) }; +} + struct ShellScriptCompleter { ShellScriptCompleter(String shell_script, @@ -1297,7 +1305,7 @@ const CommandDesc alias_cmd = { ParameterDesc{{}, ParameterDesc::Flags::None, 3, 3}, CommandFlags::None, CommandHelper{}, - make_completer(complete_scope, complete_nothing, complete_command_name), + make_completer(complete_scope, complete_alias_name, complete_command_name), [](const ParametersParser& parser, Context& context, const ShellContext&) { if (not CommandManager::instance().command_defined(parser[2])) |
