From 9e0502a1ca234bd20e17f078e75c3d5da4687a82 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 12 Feb 2023 20:29:27 +0100 Subject: [PATCH] Do not complete redundant switches --- src/command_manager.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/command_manager.cc b/src/command_manager.cc index a2f1aad5e..caae27765 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -821,7 +821,10 @@ Completions CommandManager::complete(const Context& context, { auto switches = Kakoune::complete(token.content.substr(1_byte), pos_in_token, concatenated(command.param_desc.switches - | transform(&SwitchMap::Item::key), + | transform(&SwitchMap::Item::key) + | filter([&](const auto& key) { + return not parser.get_switch(key); + }), ConstArrayView{"-"})); return switches.empty() ? Completions{}