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

InsertMode binds with<C-Key> in settings.json doesn't work. #3126

Closed
paupalou opened this issue Oct 10, 2018 · 2 comments
Closed

InsertMode binds with<C-Key> in settings.json doesn't work. #3126

paupalou opened this issue Oct 10, 2018 · 2 comments

Comments

@paupalou
Copy link

paupalou commented Oct 10, 2018

Describe the bug
Bind combinations of Control + key in settings.json when Insert mode is active (vim.insertModeKeyBindings) writes the textkeys instead doing the "keypress".

To Reproduce
Steps to reproduce the behavior:

  1. Edit settings.json, useCtrlKeys should be true.

  2. Add those keybindings
    { "before": [ "<ctrl-a>" ], "after": [ "<Esc>", "I" ] }
    { "before": [ "<ctrl-e>" ], "after": [ "<Esc>", "A" ] }

  3. Open file , start insert mode then press Control-A , it should go to start-of-line, or with Control-E should go to end-of-line

  4. Cursor doesnt move, just writed some characters (from copy register i think)

Expected behavior
Would be fine the possibility to add those bindings in settings.json , i finally made it working editing keybindings.json.
{
"key": "ctrl+e",
"command": "cursorEnd",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode == 'Insert'"
},
{
"key": "ctrl+a",
"command": "cursorHome",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode == 'Insert'"
}

Thanks!

@suo
Copy link
Contributor

suo commented Oct 16, 2018

I have a similar problem: setting:

{"before": ["<C-a>"], "commands": ["cursorHome"]}

Caused the cursor to move correctly, but <Esc> stopped working in insert mode. Checking the debug log level, it appears <Esc> wasn't even being detected.

@lpld
Copy link

lpld commented Jan 30, 2019

Faced the same issue.
Trying to do the following:

"vim.insertModeKeyBindings": [
   { "before": ["<C-e>"], "commands": ["cursorLineEnd"] }
]

If I press Ctrl+E once I can see that the key combination is handled, but the mapping is not triggered:
[Extension Host] debug: ModeHandler: handling key=<C-e>.

If I press it two times in a row, the mappings looks to be found, but nothing happens with the cursor, the standard Ctrl+e behavior is still triggered (copying characters from the line below). Here's the console output:

console.ts:134 [Extension Host] debug: Remapper: insertModeKeyBindings. before=<C-e>. command=cursorLineEnd. args=.
2console.ts:134 [Extension Host] debug: Remapper: find matching remap. keys=i,<C-e>,<C-e>. mode=Insert.```

@jpoon jpoon closed this as completed in b158b87 Jan 31, 2019
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

4 participants