Vscode-neovim: [Question] Insert mode mappings

Created on 23 Nov 2019  路  4Comments  路  Source: asvetliakov/vscode-neovim

Hello! Thank you for such an awesome plugin! Absolutely love it! 鉂わ笍

I've been trying to set up a few keymappings for insert mode. Most of them are not of a big importance, but this one is an absolute must for me and it doesn't work:

imap jj <Esc> :call VSCodeNotify('vscode-neovim.escape')<CR>

It doesn't even trigger the chord on the first j, like no reaction whatsoever.

Am I doing something wrong? Thanks!

question

Most helpful comment

Yes, something like jj or jk for the escape key won't work. And i have no plans to listen to events in insert mode unless this or this will be fixed. Sorry for inconvience!

All 4 comments

Whoops, I just realized that insert mode is run completely by VSCode, so those kind of mappings probably won't work. I'll try to add the chords through vscode settings.

Alright, I figured it out. Adding the keymap to vscode's keybindings.json with neovim.mode == insert works great!

    {
        "key": "j j",
        "command": "vscode-neovim.escape",
        "when": "editorTextFocus && neovim.mode == insert"
    }

It's probably a good idea to add a note on how to add key mappings for insert mode (with the above example). I'll send a PR tomorrow if you don't mind.

I tested my solution and it doesn't work very well. It works fine but all key combinations with the first chord get blocked like jk, jd, js etc. and you can't type them. It seems like this issue is more of VSCode problem, so I'm gonna close it for now.

Yes, something like jj or jk for the escape key won't work. And i have no plans to listen to events in insert mode unless this or this will be fixed. Sorry for inconvience!

Was this page helpful?
3.5 / 5 - 2 ratings

Related issues

pieterdd picture pieterdd  路  4Comments

mizagog picture mizagog  路  5Comments

erlais picture erlais  路  3Comments

anhyeast picture anhyeast  路  5Comments

joshua7v picture joshua7v  路  4Comments