kylechui / nvim-surround

Add/change/delete surrounding delimiter pairs with ease. Written with :heart: in Lua.
MIT License
2.98k stars 60 forks source link

Several targets like (, { and < don't work when kitty keyboard protocol is enabled #200

Closed craigmac closed 1 year ago

craigmac commented 1 year ago

Checklist

Neovim Version

HEAD

Plugin Version

Tagged (Stable)

Minimal Configuration

nvim --clean

Sample Buffer

function

Keystroke Sequence

ysiw(

Expected behavior

(function)

Actual behavior

function

Additional context

Need to have a terminal emulator with kitty keyboard protocol turned on.

Wezterm reports ( as <S-(> and [ as <S-[> along with the others: <S-lt>, <S->>

kylechui commented 1 year ago

I'm afraid I don't really know what the Kitty protocol is, nor how to replicate this issue. Perhaps try using the untagged version of this plugin, and see if that resolves things?

craigmac commented 1 year ago

Open wezterm and set enable_kitty_protocol = true as the key encoding) in the wezterm config file then just follow the steps listed. Untagged version didn't resolve things.

kylechui commented 1 year ago

This seems like it would be an issue on Wezterm's side(?); what happens when you go in insert mode and hit <C-v>(? Does it just show ( or something like <S-(> (former is correct)? The plugin should do the correct thing if given the correct inputs, but I'm not familiar with wezterm nor how it handles key inputs.

craigmac commented 1 year ago

Both wezterm (with kitty kbd protocol enabled) and actual kitty terminal both show <S-(>. It's not that one is more correct than the other, what I'm saying is shift numbers keys are all going to have this issue with your plugin because you don't also map <S-(>. I think just a simple map from <S-(> to ( would support the protocol and still leave support for non-users of the kitty kbd protocol intact.

kylechui commented 1 year ago

I just downloaded wezterm on my own computer and was able to replicate the issue, although using Kitty on a friend's Macbook it just shows ( and ), which is strange. Is it intended behavior for the keys to be represented as <S-(>?

craigmac commented 1 year ago

my mistake, you are right I had assumed kitty would be the same as wezterm is supposedly using that protocol. I'm not sure why or how they are differing. I'll mention this in wezterm issues and see why * is seen as two different things.

kylechui commented 1 year ago

Closing this issue since it seems to have been fixed upstream.