Vscode-neovim: Possible to map Command / Meta key? I.e. <D-$KEY>

Created on 7 Jan 2020  路  4Comments  路  Source: asvetliakov/vscode-neovim

Thanks for this plugin! So far it's much more flexible than the more popular vscode vim plugin.

I'm wondering, can I remap command key mappings?

Example:

nnoremap <D-j> 10j

Command + j moves down 10 lines. Are mappings like this possible?

question

Most helpful comment

yes, but for ctrl/meta/command keysequences you must additionally hint vscode to send this keysequence to neovim, as specified in the readme:

add to your keybindings.json

    {
        "command": "vscode-neovim.send",
        "key": "command+j",
        "when": "editorTextFocus && neovim.mode != insert",
        "args": "<D-j>"
    }

(actually i don't remember should cmd+j or command+j or ctrl+j be used for mac)

This way neovim will receive your D-j which can be used in any mapping

All 4 comments

yes, but for ctrl/meta/command keysequences you must additionally hint vscode to send this keysequence to neovim, as specified in the readme:

add to your keybindings.json

    {
        "command": "vscode-neovim.send",
        "key": "command+j",
        "when": "editorTextFocus && neovim.mode != insert",
        "args": "<D-j>"
    }

(actually i don't remember should cmd+j or command+j or ctrl+j be used for mac)

This way neovim will receive your D-j which can be used in any mapping

Thanks!

Sorry I missed that on my first read through. I didn't see any mention of the command key. Maybe this is the section in question: https://github.com/asvetliakov/vscode-neovim#to-pass-additional-ctrl-key-sequence-for-example--add-to-your-keybindingsjson

correct, this works for any complex key-sequence, not only for the ctrl.

Btw, feel free to reopen the issue if it doesn't work for you.

Thanks again! Yes, was going to close this out. If anyone else runs into this in the future, these mappings worked for me:

// keybindings.json

  {
    "command": "vscode-neovim.send",
    "key": "cmd+j",
    "when": "editorTextFocus && neovim.mode != insert",
    "args": "<D-j>"
  },
  {
    "command": "vscode-neovim.send",
    "key": "cmd+k",
    "when": "editorTextFocus && neovim.mode != insert",
    "args": "<D-k>"
  },


Was this page helpful?
0 / 5 - 0 ratings

Related issues

mizagog picture mizagog  路  5Comments

DrakeXiang picture DrakeXiang  路  5Comments

haberdashPI picture haberdashPI  路  3Comments

DrakeXiang picture DrakeXiang  路  4Comments

asvetliakov picture asvetliakov  路  5Comments