Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it seems cc cannot be remapped #4464

Closed
yam-liu opened this issue Jan 2, 2020 · 7 comments · Fixed by #4735
Closed

it seems cc cannot be remapped #4464

yam-liu opened this issue Jan 2, 2020 · 7 comments · Fixed by #4735

Comments

@yam-liu
Copy link

yam-liu commented Jan 2, 2020

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

@cvaldev
Copy link
Contributor

cvaldev commented Jan 6, 2020

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.

@johnbonda
Copy link

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

@J-Fields
Copy link
Member

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

This is an upstream issue - see #1017 (comment)

@yam-liu
Copy link
Author

yam-liu commented Jan 17, 2020

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

@J-Fields
Copy link
Member

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

@yam-liu
Copy link
Author

yam-liu commented Jan 22, 2020

@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.

@J-Fields
Copy link
Member

@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.

berknam pushed a commit to berknam/Vim that referenced this issue Apr 13, 2020
Refactor the Remapper and ModeHandler to allow better remapping experience.
It will allow to remap operator keys, motion keys and multiple keys when the first key could be handled.

Should fix the following issues (maybe more):
VSCodeVim#4674
VSCodeVim#4464
VSCodeVim#3988
VSCodeVim#3768
VSCodeVim#3742
VSCodeVim#2975
VSCodeVim#2955
VSCodeVim#2234
VSCodeVim#2041
VSCodeVim#1870
VSCodeVim#1821
VSCodeVim#1579
VSCodeVim#1398

Needs more testing.
@berknam berknam mentioned this issue Apr 13, 2020
10 tasks
J-Fields pushed a commit that referenced this issue Aug 16, 2020
This is a pretty massive change; see pull request #4735 for full details

Most notably:
- Support for operator-pending mode, including remaps and a half-cursor decoration
- Correct handling of ambiguous remaps with timeout
- Correct handling of recursive special case when the RHS starts with the LHS
- Correct handling of multi-key remaps in insert mode
- Failed movements that occur partway through a remap stop & discard the rest of the remap
- Implement `unmap` and `mapclear` in .vimrc

Refs #463, refs #4908
Fixes #1261, fixes #1398, fixes #1579, fixes #1821, fixes #1835
Fixes #1870, fixes #1883, fixes #2041, fixes #2234, fixes #2466
Fixes #2897, fixes #2955, fixes #2975, fixes #3082, fixes #3086
Fixes #3171, fixes #3373, fixes #3413, fixes #3742, fixes #3768
Fixes #3988, fixes #4057, fixes #4118, fixes #4236, fixes #4353
Fixes #4464, fixes #4530, fixes #4532, fixes #4563, fixes #4674
Fixes #4756, fixes #4883, fixes #4928, fixes #4991, fixes #5016
Fixes #5057, fixes #5067, fixes #5084, fixes #5125
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants