Vim: it seems cc cannot be remapped

Created on 2 Jan 2020  ·  7Comments  ·  Source: VSCodeVim/Vim

Describe the bug
I add this remap in my config.json

    "vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": [
                "c",
                "c"
            ],
            "commands": [
                "togglehs.toggleHS"
            ]
        },
        {
            "before": [
                "g",
                "h"
            ],
            "commands": [
                "togglehs.toggleHS"
            ]
        }
    ],

But gh works well, but cc not working for me.
I also tried change cc to:

                 "editor.action.deleteLines",
                 "editor.action.insertLineBefore"

no lucky too.
I wonder if cc cannot be remapped? or I configure something wrong?

To Reproduce
Steps to reproduce the behavior:

  1. use config above
  2. type cc
  3. as expected? start with syntax indent or at index 0?

Expected behavior
real cc:clear the line and indent correctly. like what ddO/^C dose.
remaped cc:remapped commands' behavior。

Screenshots
dont need

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.12.4
  • VSCode version:1.41.1
  • OS: 10.15.1

Additional context
no

areremap kinbug

Most helpful comment

@ooopscc Yeah, the originally reported issue is indeed a bug. I'll try to get to it at some point, but it's not high on my to-do list. Feel free to submit a PR if you'd like to see it fixed sooner.

All 7 comments

I'm unsure of how this can be fixed atm but I'm putting this in case it can help someone investigate it further. This seems to happen because c is an operator (ChangeOperator) and not a command or motion. It is reproducible with every operator combination, e.g. try yy, dd, <<, yyp and you'll see that they cannot be remapped either.

Yes it would be nice to have cc indent according to the syntax.

Yes it would be nice to have cc indent according to the syntax.

This is an upstream issue - see https://github.com/VSCodeVim/Vim/issues/1017#issuecomment-569801348

@J-Fields Since o can use the correct indent, why not change an implementation for cc?

@ooopscc This is all upstream. IIRC the indentation rules for a new line and reindenting an existing line are separate.

@cvaldev @J-Fields If cc can not be reimplemented, can we make cc operator remappable? Similar plugins like XVim for Xcode, or ideavim for IDEA, change operators can be remapped.

@ooopscc Yeah, the originally reported issue is indeed a bug. I'll try to get to it at some point, but it's not high on my to-do list. Feel free to submit a PR if you'd like to see it fixed sooner.

Was this page helpful?
0 / 5 - 0 ratings