Vim icon indicating copy to clipboard operation
Vim copied to clipboard

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

Open Guscccc opened this issue 1 year ago • 4 comments

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):

  • Extension (VsCodeVim) version: 1.27.3
  • VSCode version: 1.89.1
  • OS: Windows 11 23H2

Guscccc avatar May 28 '24 19:05 Guscccc

You can try this

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

use *w"

HenryTSZ avatar Jun 06 '24 06:06 HenryTSZ

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.

Guscccc avatar Jun 06 '24 09:06 Guscccc

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

HenryTSZ avatar Jun 07 '24 02:06 HenryTSZ

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.

Guscccc avatar Jun 07 '24 05:06 Guscccc