", " |>", {}) This works on macOS using iterm2, but " /> ", " |>", {}) This works on macOS using iterm2, but " /> ", " |>", {}) This works on macOS using iterm2, but "/>

How can I set a mapping for <C-S-m> in Windows terminal?

26 Views Asked by At

I'd like to remap <C-S-m> to insert |> at the cursor:

vim.api.nvim_buf_set_keymap(0, "i", "<C-S-m>", " |>", {})

This works on macOS using iterm2, but using Windows Terminal on Windows 11 I get this weird thing which I've never seen before:

enter image description here

Other key combinations that don't use ctrl + shift, e.g. <C-m>, work fine. <C-M> seems to be equivalent to <C-m>, but not to <C-S-m>.

1

There are 1 best solutions below

0
Tribhuwan On BEST ANSWER

For the issue of mapping <C-S-m> in windows terminal with Nvim, you need to bind <C-S-m> by using the sendInput command in Windows Terminal's settings.json. It will send a specific escape sequence when <C-S-m> is pressed. I prefer you to see this github issue. you can add these lines in your windows terminal's settings.json

{
    "command": {
        "action": "sendInput",
        "input": "\u001b[EscapeSequence]"
    },
    "keys": "ctrl+shift+m"
}

You need to replace "\u001b[EscapeSequence]" with the actual escape sequence that Nvim expects for inserting |>. You may need to experiment with different sequences. I can't check it since I'm not using windows