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

Unable to remap <C-s> in insert mode #2411

Closed
alexriedl opened this issue Mar 2, 2018 · 3 comments
Closed

Unable to remap <C-s> in insert mode #2411

alexriedl opened this issue Mar 2, 2018 · 3 comments

Comments

@alexriedl
Copy link

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

What happened:
Mapped <C-s> using vim.insertModeKeyBindingsNonRecursive and was unable to the mapped commands to happen. Mapped <C-n> to the same commands and that worked.

What did you expect to happen:
While in insert mode I should be able to press <C-s> or <C-n> to save the file and exit insert mode.

How to reproduce it (as minimally and precisely as possible):

  1. Add to your user settings:
"vim.insertModeKeyBindingsNonRecursive": [
    {
        "before": [ "<C-s>" ],
        "commands": [
            { "command": "workbench.action.files.save" },
            { "command": "extension.vim_escape" }
        ]
    },
    {
        "before": [ "<C-n>" ],
        "commands": [
            { "command": "workbench.action.files.save" },
            { "command": "extension.vim_escape" }
        ]
    }
],
  1. Reload window
  2. Open a file and enter insert mode (make a change)
  3. Hit <C-s>, nothing will happen. Hit <C-n> File will be saved and you will be taken out of insert mode.

Environment:

  • Extension (VsCodeVim) version: 0.11.0
  • VSCode version: 1.20.1
  • OS version: Ubuntu 17.10
@AntonPuko
Copy link

AntonPuko commented Mar 5, 2018

The same issue with <C-;> in insert mode.

  "vim.handleKeys": {
    "<C-;>": true,
  }
...
  "vim.insertModeKeyBindings": [
    {
      "before": [
        "<C-;>",
      ],
      "after": [
        "<right>",
      ]
    }
  ]

it works with <C-n>

@jpoon
Copy link
Member

jpoon commented Jun 15, 2018

Our extension doesn't bind to those keys (https://github.com/VSCodeVim/Vim/blob/master/package.json#L140), hence they go straight to the editor and vscodevim has no history of it.

If we do bind to them, that means we'll need to handle whatever <c-n> and <c-s> they are supposed to do in the editor (ie. new window/save) in the event that there is no user remapping for those keys.

@jpoon
Copy link
Member

jpoon commented Jun 16, 2018

Dupe of #757

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