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

Strange visual selection with keys remapped to ^ and $ #1835

Closed
TomNaessens opened this issue Jun 13, 2017 · 8 comments · Fixed by #4735
Closed

Strange visual selection with keys remapped to ^ and $ #1835

TomNaessens opened this issue Jun 13, 2017 · 8 comments · Fixed by #4735

Comments

@TomNaessens
Copy link

TomNaessens commented Jun 13, 2017

  • Click thumbs-up 👍 on this issue if you want it!
  • Click confused 😕 on this issue if not having it makes VSCodeVim unusable.

The VSCodeVim team prioritizes issues based on reaction count.


Is this a BUG REPORT or FEATURE REQUEST? (choose one): Bug report

Environment:

  • VSCode Version: 1.13.0
  • VsCodeVim Version: 0.8.5
  • OS: Windows 10, creators update

What happened: In my config, in otherModesKeyBindingsNonRecursive I mapped H to ^ and L to $. When I enter viasual mode (press v) and press L afterwards, it selected to the end of the visible screen. Same for H which selects to the start of the visible screen.

When I press v and then ^ or $, the correct action happens: it selects until the start or the end of the line.

What did you expect to happen: I expect that when I enter visual mode (press v) and press L afterwards, it selects to the end of line. Same for H which I expected to select to the beginning of the line.

How to reproduce it:

  1. Add the following to your settings:
    "vim.otherModesKeyBindingsNonRecursive": [
        {
            "before": ["H"],
            "after": ["^"]
        },
        {
            "before": ["L"],
            "after": ["$"]
        }
    ],
  1. Enter visual mode: press v
  2. Press H (or L)

Important: This worked fine for a few months until it stopped a few weeks ago. I went trough the changelog and the only thing that could be related is the Fixes visual block mode respect keybindings @Chillee #1709 in the Neovim Nutty release. But I'm not sure. Outside of visual mode (in normal mode for example), the work as expected.

It gets even stranger: When I enter visual mode, press a navigation key (e.g. l) once to move one space and then press L, it selects as expected until the end of the line.

@Chillee
Copy link
Member

Chillee commented Jun 15, 2017

Huh. You're right.

When I first saw this bug report, I thought it was just a limitation of our remapper (for example, dH with that mapping has never worked properly). But I just checked it on a v0.7.0, and it seems to work fine.

How interesting. I personally use this keybinding, so I'll try to figure out what's wrong soon.

@Chillee
Copy link
Member

Chillee commented Jun 15, 2017

Ok, so this is a bug that was revealed as the result of fixing another bug.

cbcc982

is the commit that caused it.

@benjaminwood
Copy link

I too have been impacted by this bug. In my case I had remapped hjkl to jkl;. Same symptom though, switch to visual mode and the remappings do not take effect until at least one key has been pressed.

@jwmann
Copy link

jwmann commented Apr 17, 2019

I have this same exact issue.

Except since vim.otherModesKeyBindingsNonRecursive was removed, it's more like this:

    "vim.visualModeKeyBindingsNonRecursive": [
        {
            "before": ["j"],
            "after": ["g", "j"]
        },
        {
            "before": ["k"],
            "after": ["g", "k"]
        },
    ],

@uri
Copy link

uri commented Jun 18, 2019

These bindings seem to work if you pause for 2-3 seconds after entering visual mode.

With

{
            "before": ["H"],
            "after": ["^"]
}

v pause for 3 seconds H produces the the correct behavior

@charlietran
Copy link

I'm still experiencing this bug, but this workaround from #2842 fixes it for now:

  "vim.normalModeKeyBindings": [
    ...
    {
      "before": ["v"],
      "after": ["v", "l", "h"]
    }
    ...
]

@jakalada
Copy link

スクリーンショット 2019-06-22 15 03 13

I change Vim Configuration > Timout to 0, This issue is solved. But, it is not a good solution.

@thisisrandy
Copy link
Contributor

Any movement on this? The workaround that @charlietran references breaks text object motions, e.g. viw, so it isn't really viable

@berknam berknam mentioned this issue May 20, 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.

8 participants