Created attachment 103446 [details] possible solution Standard kate commands (normally available via F7) are not available in VI mode. It is also impossible to add a new command via plugin which will be visible in VI mode. I've attached the diff with a possible solution. Problem is visible in version 5.30.
@Simon: Does that make sense, or can that possibly interfere with other vi actions?
Will take a look over the weekend. In the meantime: @jaro - can you give steps to reproduce? I'll need this to form a regressoin test.
Hi, sorry for so late response. I've wrote some simple plugin in C++ to add some additional commends. The new commands are available in normal input mode but not visible in VI mode. They are added to command set which is not available in VI mode.
Hi, Jan Paul Batrina, would such a change make sense?
I think it makes sense since we add non-vimode commands already (https://invent.kde.org/frameworks/ktexteditor/-/blob/master/src/vimode/emulatedcommandbar/commandmode.cpp#L46), and excluding some (e.g. the char command) would be an annoying inconsistency since switching to non-vimode will be needed just to access those kate commands. For conflicting commands, I think it would be safer to prefer the vimode versions if present. That means in the attached patch, I think that the kate commands should be added BEFORE the vimode commands since commands with the same string will overwrite the previous command (https://invent.kde.org/frameworks/ktexteditor/-/blob/master/src/vimode/emulatedcommandbar/commandmode.cpp#L60. I haven't checked yet if `KateCmd::self()->commands()` has commands that have already been added by the previous cmds.push_back calls.
(In reply to Jan Paul Batrina from comment #5) > I think it makes sense since we add non-vimode commands already > (https://invent.kde.org/frameworks/ktexteditor/-/blob/master/src/vimode/ > emulatedcommandbar/commandmode.cpp#L46), and excluding some (e.g. the char > command) would be an annoying inconsistency since switching to non-vimode > will be needed just to access those kate commands. > > For conflicting commands, I think it would be safer to prefer the vimode > versions if present. That means in the attached patch, I think that the kate > commands should be added BEFORE the vimode commands since commands with the > same string will overwrite the previous command > (https://invent.kde.org/frameworks/ktexteditor/-/blob/master/src/vimode/ > emulatedcommandbar/commandmode.cpp#L60. > > I haven't checked yet if `KateCmd::self()->commands()` has commands that > have already been added by the previous cmds.push_back calls. Are you interested in working on this?
That is not totally trivial, if we add all commands, we need to ensure we handle the removal of them, too. Otherwise we will later work on invalid pointers. If someone has time to work an this, patches are welcome. https://kate-editor.org/join-us/