Vim: handleKeys is not overriding VS Code Ctrl+R and Ctrl+F shortcuts

Created on 19 Feb 2019  路  7Comments  路  Source: VSCodeVim/Vim

Describe the bug
vim.handleKeys is not overriding VS Code Ctrl+R and Ctrl+F shortcuts.
It does work with Ctrl+A, so it looks like a problem with the two mentioned

Expected behavior
It should override all the specified shotrcuts from VIM.

This is the config used
"vim.handleKeys": { "<C-a>": false, "<C-f>": true, "<C-r>": true, "<C-y>": false }

As mentioned above, setting C-a disables the Select All functionality on VS Code, but C-f and C-r are not overriding Find, and Replace.

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.0.8
  • VSCode version:
    Version: 1.31.1 (user setup)
    Commit: 1b8e8302e405050205e69b59abb3559592bb9e60
    Date: 2019-02-12T02:20:54.427Z
    Electron: 3.1.2
    Chrome: 66.0.3359.181
    Node.js: 10.2.0
    V8: 6.6.346.32
    OS: Windows_NT x64 10.0.17763

Additional context
Add any other context about the problem here.

kinquestion

Most helpful comment

https://github.com/VSCodeVim/Vim#-faq. Feel free to re-open if that is not the case.

All 7 comments

https://github.com/VSCodeVim/Vim#-faq. Feel free to re-open if that is not the case.

@jpoon I'm not sure what am I supposed to find on that FAQ. The only thing related is this:

Problem:
> None of the native Visual Studio Code ctrl (e.g. ctrl+f, ctrl+v) commands work
Suggested solution:
> Set the useCtrlKeys setting to false.

which is actually the opposite example of the problem I'm having. I have useCtrlKeys set to true and some VIM commands are still not working.

Also, I provided a detailed explanation of which keys are not overriding the native VSC behaviour and which are (which should be enough indication of a potential bug), so I'm unsure about why this got closed.

From the documentation https://github.com/VSCodeVim/Vim#vscodevim-settings:

vim.handleKeys
Delegate configured keys to be handled by VSCode instead of by the VSCodeVim extension. Any key in keybindings section of the package.json that has a vim.use<C-...> in the when argument can be delegated back to VS Code by setting "<C-...>": false. Example: to use ctrl+f for find (native VS Code behaviour): "vim.handleKeys": { "<C-f>": false }.

So setting true for ctrl+f should make the plugin use the VIM command, not the native Find VSC command. That is not happening, so it looks like a bug to me. Same problem with ctrl+r (which is the one I really care about), it opens the Find and Replace command from VSC instead of the VIM redo command when "<C-r>": true. It doesn't make any difference whether they are set to true or false, but from the documentation, it looks like it should.

ctrl+v works as expected when set to true, disabling the VSC command in favour of the VIM one. So some ctrl+key work as expected, some don't.

tried to rebind with the following:

  "vim.insertModeKeyBindings": [
    {
      "before": ["<C-s>"],
      "after": [":w", "<Esc>"]
    }
  ],

doesn't work either

I don't know why this is closed, seems to affect people...

It matters the mode you're in:

 "vim.handleKeys": {
        "<C-f>": true
    },
    "vim.useCtrlKeys": true,

This disable the VSC default keymap for find in __normal__ mode. Toggling the handleKeys to false, will get the vsc find again. Great working...

__but__ whether true or false find will always open when in insert mode!

AFAIK this is true for most C- bindings, like <C-b> works in normal, BUT will hide vsc explorer in insert mode...

Please re-open issue, because the docs need to be updated and say Ctrl bindings can only be for normal mode, or this is a bug where it does not capture for insert mode.

I don't understand why this was closed either.

"vim.useCtrlKeys": true works, I put it above handleKeys not that that should matter for json

Also having this issue. Solved it by removing the Ctrl + R keybinding for 'Replace' which now defaults to the vim binding instead. Goto File > Preferences > Keyboard Shortcuts, pressing the Record Keys button in the search bar (keyboard icon) and type Ctrl + R to bring up those bindings and removing the 'Replace' binding entirely.

You may have to adjust the bindings some more depending on what your keymap looks like, you can also do the same for all other keys you're having issues with.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

liamdawson picture liamdawson  路  3Comments

Jimmy-Z picture Jimmy-Z  路  3Comments

gerardmrk picture gerardmrk  路  3Comments

edwintorok picture edwintorok  路  3Comments

spinningarrow picture spinningarrow  路  3Comments