Bug 334399 - Vi Insert mode same as regular kate editing
Summary: Vi Insert mode same as regular kate editing
Status: RESOLVED INTENTIONAL
Alias: None
Product: kate
Classification: Applications
Component: Vi Input Mode (other bugs)
Version First Reported In: Git
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-06 03:22 UTC by pablo.speciale
Modified: 2016-09-05 12:06 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pablo.speciale 2014-05-06 03:22:01 UTC
It would be nice to have an option which 'force' the Vi Insert mode to be exactly the same as regular kate editing, with the usual kate key bindings. I mean, Vi Insert Mode key bindings are not emulated. For example, a shortcut which isn't available in Vi Insert Mode is: "ctrl+shift+left" (word selection).

With this option, Vi Mode could be seem as a super set of kate functionalities (since nothing is different in Vi Insert Mode, plus adding the power of Vi Normal/Visual Mode). I find this specially useful, for example, in kdevelop where there are many shortcuts that can be still used when Vi Mode is selected. Currently, after Vi Mode is selected (in the Kate configuration panel) the user defined shortcuts aren't available (probably this is a different bug/request).

This approach is successfully used in vintage, the vim plugin for sublime.


Reproducible: Always
Comment 1 Miquel Sabaté 2014-05-07 06:23:44 UTC
I'm honestly not specially in favor of this. Call me a vim purist if you want :) I'm not marking this as "WONTFIX" or anything like that because if someone steps in and writes a good patch I might change my mind :) Thanks for the bug report anyways :)
Comment 2 pablo.speciale 2014-05-07 23:08:28 UTC
Yes, I agree it shouldn't be the default option, but I would like to have it.

I am not familiar with the development process but I would like to try. Could you (or someone else) point me out where I should look as an starting point? I mean, at some point the shortcuts are redefined for the insert mode, where is this happening in the code?

Thanks!
Comment 3 Michal Humpula 2014-05-31 10:00:23 UTC
Hi Pablo,

the vi-mode should only "eat" the keys that are doing something. If it's not interested in those it let's the shortcut system to done it's job. 

Try to turn of "Let Vi commands override Kate shortcuts", maybe that's what you are looking for.
Comment 4 pablo.speciale 2014-05-31 23:46:26 UTC
Hi Michal,

Thanks for the answer!

When I turn off "Let Vi commands override Kate shortcuts" option, it is almost what I am looking (for insert mode) except that some shortcuts doesn't work, e.g.: "shift+left" (char selection) and "ctrl+shift+left" (word selection). This might be a different bug. So, even with this option off, there are some differences with the regular kate editing.

And the real problem with this option is that I want to have the vim navigation like "ctrl+d" and "ctrl+u". I would rather prefer to have two different options:
   1. "Let Vi commands override Kate shortcuts" (in normal mode)
   2. "Let Vi commands override Kate shortcuts" (in insert mode). Or another text like: "Vi insert mode as regular kate editing."

I've tried to "fix" this request myself, but I couldn't figure out where the vi-mode "eats" the keys. I think it is in 'KateView::deactivateEditActions()'. Another place I was looking at is:
    part/view/kateviewinternal.cpp:2337:    if ( getViInputModeManager()->getCurrentViMode() == InsertMode

but then... I don't know what to do :P

Thanks!
Comment 5 pablo.speciale 2014-05-31 23:47:42 UTC
Hi Michal,

Thanks for the answer!

When I turn off "Let Vi commands override Kate shortcuts" option, it is almost what I am looking (for insert mode) except that some shortcuts doesn't work, e.g.: "shift+left" (char selection) and "ctrl+shift+left" (word selection). This might be a different bug. So, even with this option off, there are some differences with the regular kate editing.

And the real problem with this option is that I want to have the vim navigation like "ctrl+d" and "ctrl+u". I would rather prefer to have two different options:
   1. "Let Vi commands override Kate shortcuts" (in normal mode)
   2. "Let Vi commands override Kate shortcuts" (in insert mode). Or another text like: "Vi insert mode as regular kate editing."

I've tried to "fix" this request myself, but I couldn't figure out where the vi-mode "eats" the keys. I think it is in 'KateView::deactivateEditActions()'. Another place I was looking at is:
    part/view/kateviewinternal.cpp:2337:    if ( getViInputModeManager()->getCurrentViMode() == InsertMode

but then... I don't know what to do :P

Thanks!
Comment 6 Michal Humpula 2014-06-01 07:25:14 UTC
As for the where to find the code responsible for this, it's in the KateViewInternal::eventFilter and  KateViewInternal::keyPressEven which unfortunatelly is one of the most complicated parts. And on top of that KateView::deactivateEditActions plays it's role too.

As for the ovveride switch, we could probaly end up in with more fine grained key binding system in the future. But it's not a near future.
Comment 7 Christoph Cullmann 2016-09-05 12:06:48 UTC
Dear user, this wish list item is now closed, as it wasn't touched in the last two years and no contributor stepped up to implement it.

The Kate/KTextEditor team is very small and we can just try to keep up with fixing bugs. Therefore wishs that show no activity for two years or more will be closed from now on to keep at least a bit overview about 'current' wishs of the users. If you want your feature to be implemented, please step up to provide some patch for it.

If you think it is really needed, you can reopen your request, but keep in mind, if no new good arguments are made and no people get attracted to help out to implement it, it will expire in two years again.

We have a nice website kate-editor.org that provides all the information needed to contribute, please make use of it. For highlighting improvements our user manual shows how to write syntax definition files. Greetings Christoph