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

Visual Mode doesn't respect overridden keybindings #2842

Closed
AeroCross opened this issue Jul 16, 2018 · 4 comments
Closed

Visual Mode doesn't respect overridden keybindings #2842

AeroCross opened this issue Jul 16, 2018 · 4 comments

Comments

@AeroCross
Copy link

AeroCross commented Jul 16, 2018

Describe the bug
The visualModeKeyBindings{NonRecursive} option ignores some motion keybindings.

To Reproduce

  1. Open settings
  2. Define a custom keybinding inside the file, like this:
  "vim.visualModeKeyBindingsNonRecursive": [
    {
      "before": ["H"],
      "after": ["^"],
    },
    {
      "before": ["L"],
      "after": ["$"],
    },
  ]
  1. Save the file
  2. Reload VS Code
  3. Open settings
  4. Find vim.visualModeKeyBindingsNonRecursive and position the cursor over the dot (.) after vim
  5. Enter Visual Mode
  6. Press L

Expected behavior
Select from the position of the cursor until the end of the line in visual mode (same as using the $ motion as stated in the config)

Actual behaviour
Selects from the position of the cursor until the end of the viewport (L's default behaviour, instead of the one defined in the config file)

Environment

  • Extension Name: vim
  • Extension Version: 0.15.0
  • OS Version: Darwin x64 16.7.0
  • VSCode version: 1.25.1
{
	"activationTimes": {
		"startup": true,
		"codeLoadingTime": 260,
		"activateCallTime": 5,
		"activateResolvedTime": 82,
		"activationEvent": "*"
	}
}

Additional context

I can confirm that using vnoremap L $ in regular vim behaves as expected. Other visual mode commands (such as y$) do work, but only after I've pressed v to enter visual mode _and pressed another key that's not escape). This seems to be a different bug.

@expelledboy
Copy link

@AeroCross Have been looking though the issues and have found mulitple duplicates, with thumbs up spread amoungst them all;

#1261
#1835
#2233
#1398
#1870
#2131
#2234

And duplicate, with some work having been done;
#1835

@expelledboy
Copy link

Actually, a significant percentage of issues is regarding remapping of key bindings.

Perhaps we can pool resources to work on a release which would resolve all of them in 1 shot!

@AeroCross
Copy link
Author

I'd be happy to help in any way I can, although my knowledge of the internals of this extension and TypeScript in general is very small 😅

A couple of those issues does shed some light about what the issue is.

In #2131 (comment) and #1835 (comment), you can see that the workaround is pressing another key, because visual mode keybinds don't work otherwise. I think this is because when visual mode is turned on, v is passed as a chord of sorts.

screen shot 2018-07-16 at 7 50 57 pm

See that extra v after --VISUAL--? It's the same if you had pressed d in normal mode for example. It's expecting another keybinding. That's a bug.

It would also seem that this has been happening for a while.

As a workaround:

  "vim.normalModeKeyBindings": [
    // Workaround: Visual Mode chord bug
    // https://github.com/VSCodeVim/Vim/issues/2842
    {
      "before": ["v"],
      "after": ["v", "l", "h"]
    },

@xconverge
Copy link
Member

Closing as duplicate of #1835

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants