Vim icon indicating copy to clipboard operation
Vim copied to clipboard

Use % to also trigger Emmet: Go To Matching Tag

Open trusktr opened this issue 6 years ago • 10 comments

It would be super sweet if the % key also triggered Emmet: Go To Matching Tag (built-in command that ships with VS Code) when on HTML tags.

trusktr avatar Jul 08 '19 05:07 trusktr

One thing you can do for now is map "editor.emmet.action.matchTag" to a key. I've mapped <leader> % to run editor.emmet.action.matchTag.

"vim.normalModeKeyBindingsNonRecursive": [
    {
      "before": ["<leader>", "%"],
      "commands": [
        {
          "command": "editor.emmet.action.matchTag"
        }
      ]
    }
]

mikowl avatar Jul 08 '19 21:07 mikowl

That's cool. Maybe I can make my own function, and have % trigger my function, then in my function I can conditionally call one or the other? Can you guide me the direction for this? It's very easy in Atom (which seems a lot easier to extend).

trusktr avatar Jul 25 '19 23:07 trusktr

Unfortunately emmet go to matching tag does not work in react native. Just FYI.

uloco avatar Jan 30 '20 15:01 uloco

This works out of the box with the Neo Vim VS Code extension (real Neovim controls the VS Code text buffers), including in JSX expressions (f.e. React Native @uloco).

neo-vim-go-to-matching-JSX

trusktr avatar Dec 22 '20 19:12 trusktr

It's 2023 now. Is this still open?

gaoqiangks avatar Jan 13 '23 21:01 gaoqiangks

should work on this but the config works fine ;D

One thing you can do for now is map "editor.emmet.action.matchTag" to a key. I've mapped % to run editor.emmet.action.matchTag.

"vim.normalModeKeyBindingsNonRecursive": [
    {
      "before": ["<leader>", "%"],
      "commands": [
        {
          "command": "editor.emmet.action.matchTag"
        }
      ]
    }
]

sdykae avatar Aug 04 '23 06:08 sdykae

it is not for visual mode even config this:

  "vim.visualModeKeyBindingsNonRecursive": [
    {
      "before": ["<leader>", "%"],
      "commands": [
        {
          "command": "editor.emmet.action.matchTag"
        }
      ]
    }
  ]

xvusrmqj avatar Dec 07 '23 08:12 xvusrmqj

it is not for visual mode even config this:

  "vim.visualModeKeyBindingsNonRecursive": [
    {
      "before": ["<leader>", "%"],
      "commands": [
        {
          "command": "editor.emmet.action.matchTag"
        }
      ]
    }
  ]

Does anyone know how to configure it for visual mode properly to select from open tag to closing tag?

habibium avatar Apr 21 '24 01:04 habibium

@HabibMollah Isn't vat good for selecting whole tag? (or vit for just the content inside)

LukaErnestini avatar Jul 25 '24 08:07 LukaErnestini

@HabibMollah Isn't vat good for selecting whole tag? (or vit for just the content inside)

@LukaErnestini Yes it is! Found out about this motion few days later after I posted the comment above.

habibium avatar Jul 31 '24 18:07 habibium