Kakoune: Add count support for `\` command

Created on 12 Jul 2020  Â·  6Comments  Â·  Source: mawww/kakoune

Level

  • 0 ⇒ Hooks (Default)
  • 1 ⇒ Hooks
  • 2 ⇒ Mappings
  • 3 ⇒ Hooks and mappings

Example – Disable hooks and mappings:

3\i(hello)<esc>
feature request

Most helpful comment

Maybe we could simply change \ to also disable mappings ?

I sometimes use \ followed by the key I mapped to :write so this would be a bit unexpected to me.

Maybe it is still the best solution though. Other options that come to mind are <a-\> (\<a-\> to disable both hooks and mappings) or \\.

All 6 comments

\ is not a command, but a parameter, currently you can do 3\o and that opens 3 lines in insert mode with hooks disabled.

We could probably use the count when we press \ and make it mandatory to do \3o to get the previous behavour, but I am not sure I see a good use case for this feature. In scripting we can already do that with -with-maps and -with-hooks on execute-keys, so I imagine this is for interactive usage, could you describe a case where you really needed that feature ?

I need this feature to temporarily disable [auto-pairs.kak].

Maybe we could simply change \ to also disable mappings ?

The repeat changes command has also very weird behavior with mappings. I recently changed the implementation from hooks to maps and cannot commit repetitive changes now.

Maybe we could simply change \ to also disable mappings ?

I sometimes use \ followed by the key I mapped to :write so this would be a bit unexpected to me.

Maybe it is still the best solution though. Other options that come to mind are <a-\> (\<a-\> to disable both hooks and mappings) or \\.

Alt + \ is a bit hard for me to reach. When keys are on the edge, and require another key (the command to be unhooked/unmapped), I tend to prefer typing 2 keys (with the count (left hand) and \ (right hand)) rather than holding a modifier, release and press the command to be escaped.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lenormf picture lenormf  Â·  4Comments

lenormf picture lenormf  Â·  3Comments

radare picture radare  Â·  3Comments

alexherbo2 picture alexherbo2  Â·  4Comments

dpc picture dpc  Â·  4Comments