Closed mnpqraven closed 1 year ago
Update on the issue:
I've found out that the key map that caused the issue was the l
key triggering the cursor to move up if I also remap it to all the modes. When I press cs
the cursor would somehow move up just move up and the above surround would get selected instead. The problem can be resolved by only mapping the l
keys for navigation in strictly normal and insert mode. Not really sure myself how the l key can cause conflicts with the plugin though.
vim.keymap.set({ 'n', 'v' }, 'l', 'gk')
Hmm... I think this might be related to the fact that some of the functions use g@l
as a return value in order to enable dot-repeating. I'll look into this a bit more and see if there's something that can help with that.
Just dropping my $0.02 to say that I'm seeing something similar, though I'm not sure if it's same issue.
Given "this" string cs"' just jumps to the first double quote character. Oddly enough, it works fine with backticks (that is, if the initial surround is ', and I do cs'`, then it replaces the single quotes with backticks just fine. It's just with single and double quotes that's messing up for some reason. Trying to see if it's something in my config that could be doing it.
Just dropping my $0.02 to say that I'm seeing something similar, though I'm not sure if it's same issue.
Given "this" string cs"' just jumps to the first double quote character. Oddly enough, it works fine with backticks (that is, if the initial surround is ', and I do cs'`, then it replaces the single quotes with backticks just fine. It's just with single and double quotes that's messing up for some reason. Trying to see if it's something in my config that could be doing it.
@xorander00 I don't think that your situation is related, unless you too are using some other keyboard layout that requires you to remap most keys (in particular, l
). Feel free to open a different issue for this.
I've cleared up some of the other more pressing issues; I'll try my best to dedicate more time to thinking of ways to work around this problem.
@mnpqraven @sxyazi Can both of you please switch to branch fix-l-mapping
and see if that resolves your issue? For some reason I had some remap = true
in the keymaps, when I think removing them should avoid your default mappings, instead utilizing the default l
key.
I switched to the fix-l-mapping
branch and tested it, it now works fine with my remapping of l
, thanks for your work!
Of course, thanks for opening the issue and being so patient.
Checklist
:h nvim-surround
to see if there might be any relevant information there?Neovim Version
Plugin Version
Tagged (Stable)
Minimal Configuration
Sample Buffer
Keystroke Sequence
cursor inside the for loop, changing the surrounds with
cs{ttest<CR>
Expected behavior
only the for loop's brackets get changed
Actual behavior
the for loop's parent (the function brackets) is selected instead if my cursor is at specific position noted below
Additional context
https://user-images.githubusercontent.com/8957788/212528698-74667943-2e3d-4e59-86aa-1c2f892d6ca3.mp4
https://user-images.githubusercontent.com/8957788/212528699-754e48b1-6431-493f-b9af-08fe9b84efcd.mp4
I'm using a colemak keyboard and therefore needed to change some of my basic vim keys to another layout and cause the surround to select the parent surrounds in some cases. I've noticed 2 things when trying to reproduce this bug(?)
The surround would work correctly if my cursor is on the
q
in the firstget_req()
or anywhere on the right side or in the lines below, but the surround would incorrectly select the outer surround (the function parens) if my cursor is anywhere on the left. I hope this makes sense.