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

Custom key to enter normal mode #7

Open
Oliver-Fish opened this issue Jul 24, 2018 · 2 comments
Open

Custom key to enter normal mode #7

Oliver-Fish opened this issue Jul 24, 2018 · 2 comments
Labels
enhancement New feature or request

Comments

@Oliver-Fish
Copy link

Hi,

Would it be possible to add a setting to define a new key sequence to enter normal mode?
In my current vim workflow I like to use 'jk' and I know quite a few people use variations upon this.

Thanks

@jpotterm
Copy link
Owner

Thanks for the suggestion! I know this is something that is fairly common in Vim, but unfortunately I don't think there's a good way to implement this in a VSCode extension. So for now you'll have to use VSCode's native keybindings for this. That means jk isn't practical because VSCode's keybindings aren't smart enough to type the j character if it's not followed by k. But you could do something like Ctrl+j Ctrl+k instead. Just add this to your keybindings.json:

{
    "key": "ctrl+j ctrl+k",
    "command": "extension.simpleVim.escapeKey",
    "when": "editorTextFocus"
}

I don't want to support this in this extension for two reasons. First, it's really a feature request for VSCode's keybindings. Second, in order to support this I'd have to intercept every keypress in insert mode and then forward any that aren't jk to VSCode. That's hacky and I think it would cause bugs. At the moment, insert mode doesn't intercept any keys, it just uses the normal VSCode keybinding system to listen for the Escape key (similar to the code snippet above). So insert mode is just vanilla VSCode, and I'd like to keep it that way.

@jpotterm jpotterm added the enhancement New feature or request label Jul 24, 2018
@ericdouglas
Copy link

@Oliver-Fish you have this feature here:

"vim.insertModeKeyBindings": [
    {
      "before": ["j", "k"],
      "after": ["<Esc>"]
    }
  ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants