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

vim.remap command seems not working. #1662

Closed
millionbonus opened this issue May 6, 2017 · 3 comments
Closed

vim.remap command seems not working. #1662

millionbonus opened this issue May 6, 2017 · 3 comments

Comments

@millionbonus
Copy link

millionbonus commented May 6, 2017

  • Click thumbs-up 👍 on this issue if you want it!
  • Click confused 😕 on this issue if not having it makes VSCodeVim unusable.

The VSCodeVim team prioritizes issues based on reaction count.


What happened:
A new remapping options feature "vim.remap" was mentioned in change log . Then I tried it with the setting keybinding as same as issue #1543.

{
        "key": "F3",
        "command": "vim.remap",
        "when": "editorTextFocus",
        "args": {
            "value": ["a", "b", "c", "<Esc>"]
        }
}

As issue #1543 described. F3 can enter Insert Mode, insert bc and quit Insert Mode. However it seems not working.

How to reproduce it:

  1. Changed keybindings.json as below:
[ 
    {
        "key": "F3",
        "command": "vim.remap",
        "when": "editorTextFocus",
        "args": {
            "value": ["a", "b", "c", "<Esc>"]
        }
    }
]
  1. Restart vscode.
  2. Click text area to ensure that editor was getting focus.
  3. Press F3

What did you expect to happen:
Press F3 in text area can enter Insert Mode, insert bc and quit Insert Mode.

What happened instead?
Nothing happened.

Environment:

  • VSCode Version: 1.12.1
  • VsCodeVim Version: 0.7.0
  • OS: Windows 10
@xconverge
Copy link
Member

closing in favor of #1543

@FrankFrankWei
Copy link

Does vim.remap work now? I've tried this but this command does not work too.

@solson
Copy link

solson commented Sep 9, 2020

This does work today. I just figured out I can use the following in keybindings.json to use ctrl+/ to clear search highlights:

    {
        "key": "ctrl+/",
        "when": "editorTextFocus && vim.active && !inDebugRepl",
        "command": "vim.remap",
        "args": {
            "commands": [
                {
                    "command": ":nohlsearch"
                }
            ]
        }
    }

The trick is that the args must take this shape (as defined here):

interface ICodeKeybinding {
  after?: string[];
  commands?: { command: string; args: any[] }[];
}

The example use of "value" was either outdated or pseudocode — instead we use { "after": ["d", "d"] } to bind to the vim keys dd or { "commands": [...] } to bind to vim commands, as in my example.

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

7 participants