VSCodeVim / Vim

:star: Vim for Visual Studio Code
http://aka.ms/vscodevim
MIT License
13.57k stars 1.3k forks source link

Remapping of `ys` as in the vim.surround plugin doesn't work. #9045

Open Guscccc opened 1 month ago

Guscccc commented 1 month ago

Describe the bug When trying to use the following setting to remap * to ys which is the trigger for vim.surround plugin, it doesn't work as expected:

    "vim.normalModeKeyBindingsNonRecursive": [
       {
            "before": [
                "*"
            ], 
            "after": [
                "y",
                "s"
            ]
        },
]

To Reproduce Use the aforementioned remapping. and type * in normal mode, then a and a quotation mark like aw" (i.e. type *aw" in normal mode).

Expected behavior The word under the cursor be surrounded in ", which is the behaviour of typing ysaw" in normal mode.

Environment (please complete the following information):

HenryTSZ commented 1 month ago

You can try this

    {
      "before": ["*"],
      "after": ["y", "s", "a"]
    },

use *w"

Guscccc commented 1 month ago

You can try this

    {
      "before": ["*"],
      "after": ["y", "s", "a"]
    },

use *w"

it not working either, the editor enters insert mode the same way as just typing a, as if ys is not typed.

HenryTSZ commented 1 month ago

You can try this

    {
      "before": ["*"],
      "after": ["y", "s", "a"]
    },

use *w"

it not working either, the editor enters insert mode the same way as just typing a, as if ys is not typed.它也不起作用,编辑器进入插入模式的方式与仅键入 a 相同,就好像未键入 ys 一样。

ys

Guscccc commented 1 month ago

You can try this

    {
      "before": ["*"],
      "after": ["y", "s", "a"]
    },

use *w"

it not working either, the editor enters insert mode the same way as just typing a, as if ys is not typed.它也不起作用,编辑器进入插入模式的方式与仅键入 a 相同,就好像未键入 ys 一样。

ys ys

Thank you! I have confirmed that using this key binding in vim.normalModeKeyBindings does work as expected as you've pointed out; it's that using it in vim.normalModeKeyBindingsNonRecursive that doesn't work. Still I wonder why.