kylechui / nvim-surround

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

Keybindings mess #167

Closed velislavvasilev closed 1 year ago

velislavvasilev commented 1 year ago

The plugin works very well, but with my messy keybindings - does not. Because I have colemak layout, it is messy in vim/neovim to change it without any issues. My keybindings are as follow here, but in neovim 0.8 via lua configuration like that: keymap("", "d", "g", opts) keymap("", "e", "k", opts) .... .... keymap("", "U", "I", opts) keymap("", "Y", "O", opts)

I have some issues with other plugins as well, but not all of them. I don't know how, but default keys are little messy as well. For example, "dg" works as "gg" qwerty instead "dd". More of them have a swapped first letter (fox example "gc" ) where "g" is "t" on qwerty, but "c" is the same key on both layouts. With my keybinds the plugin does't react at all. Most of the plugins works fine with/without my keymaps from above. It is just a matter which key I'm pressing - g or t. vimwiki does't work as well. For example I can't open a link with pressing Enter when the cursor is on it so maybe is a plugins problem. Regards

kylechui commented 1 year ago

A bit of a dumb question but I have to ask---are all your keymaps noremap? Aside from that your situation seems quite strange indeed, and I'm not 100% sure. Perhaps consider dropping a working minimal config here?

velislavvasilev commented 1 year ago

So that is my keymap.lua file. https://github.com/velislavvasilev/nvimconfig/blob/main/ars Without lines 12 to 43 - the plugin works fine.

kylechui commented 1 year ago

Have you tried setting the keymaps for the plugin? For example,

require('nvim-surround').setup({
    keymaps = {
        normal = "jr", -- See :h nvim-surround.config.keymaps
    },
})
velislavvasilev commented 1 year ago

Yes, but with leader r etc. With jr I can't because j is yank.

kylechui commented 1 year ago

Hmm... I tried the file you linked as a minimal configuration file via nvim -u minimal_config.lua, and was able to use the jr prefix as intended as far as I can tell. In particular, I ran jruw) (equivalent for ysiw)) and was able to surround the current word with parentheses. If you're on the tagged version of the plugin, I would consider using the untagged (beta) version as well, as I might've accidentally fixed the bug in a different commit.

kylechui commented 1 year ago

@velislavvasilev If switching fixed it, please close this issue. If not, can you send me an exact set of steps including a minimal config that will help me reproduce the issue? Please also include Neovim version and update nvim-surround to the latest commit.

velislavvasilev commented 1 year ago

Isn't fixed. I just give up, because is not just nvim-surrond, but other plugins as well. So, I've done some test on Debian/Arch/Manjoro with neovim 0.7.2 and 0.8 without any configuration apart the keybindings from above and packer to install the plugin. Nvim-surround is updated via packer - no idea which version/tag is it. I don't know what is the problem with those keybindings, but some things doesn't work as well. Fox example "ge" doesn't work at all, vimwiki I can't jump into a link via pressing Enter on top of it, surround.nvim also doesn't work. All of those plugins works fine, without any issues, including nvim-surround, which is amazing and is doing very well the job, if the keybinding aren't enabled. It is little bit pain for me to use nvim in colemak layout, but I will be fine. The funny think is, because I try to figure out which keys exactly doing that, is not suspected ones c,s,d on both layouts. If they are not enabled and works as default, but the rest of the keys are remapped, the issue exist.

velislavvasilev commented 1 year ago

Solved. Entire config is wrong (from example below). I should use 'langmap' , not keymap. Guilty , sorry about that.

kylechui commented 1 year ago

No worries, glad you were able to fix it!