Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redundant smear on pressing navigation keys with mapings attached #88

Open
qwrtln opened this issue Jan 21, 2025 · 5 comments
Open

Redundant smear on pressing navigation keys with mapings attached #88

qwrtln opened this issue Jan 21, 2025 · 5 comments
Labels
bug Something isn't working help needed Need help from contributors

Comments

@qwrtln
Copy link

qwrtln commented Jan 21, 2025

Pressing and holding the j key, and then releasing it, results in the following:

smear.mp4

after the scrolling down is complete, there's a redundant smear. I'm fairly certain the issue stems from the following mappings:

local map = vim.api.nvim_set_keymap
local options = { noremap = true }

map("i", "jk", "<Esc>", options)
map("n", "jk", "<Esc>", options)
map("v", "jk", "<Esc>", options)
map("c", "jk", "<Esc>", options)

With them, the issue is easily reproducible. Is there anything I can do to keep my mappings and get rid of the redundant smear?

Environment

  • OS: arch
  • Terminal: alacritty
  • Neovim version: 10.3
  • Smear-cursor version/commit: main branch, commit 005b50b
@qwrtln qwrtln added the bug Something isn't working label Jan 21, 2025
@sphamba sphamba added the help needed Need help from contributors label Jan 21, 2025
@sphamba
Copy link
Owner

sphamba commented Jan 21, 2025

Indeed, this is due to j being interpreted as an incomplete jk keybinding, which are known to block the smear update animation (see #15). In reality, the smear is not actually redundant, as it does not appear when holding j. Unfortunately, I have no idea how to solve this...

Alternatively, you can look into remapping your Caps lock key into Esc, which would make the jk binding no longer needed!

@qwrtln
Copy link
Author

qwrtln commented Jan 21, 2025

I see, thanks for responding so promptly. I'm possibly attached to the jk binding a little too much, ahhah, probably because of the keyboard:

Image

I have Esc under my right thumb, but I go so reliant on jk that I can hardly unlearn it now. There is no way to exclude j (or any other key) from triggering the smear animation?

@sphamba
Copy link
Owner

sphamba commented Jan 21, 2025

Nice keyboard! I just found out about the vim.on_key() function that detect key presses . I'll see if I can do something with it

@sphamba
Copy link
Owner

sphamba commented Jan 28, 2025

Upon testing, vim.fn.screenrow() and vim.fn.screencol() don't return up to date information when inputting incomplete keybindings in sequence, e.g. jjjjjk when jk is mapped. Any smear animation is also blocked (see #15).

One way to solve this would be to override the user mappings (like https://github.com/folke/which-key.nvim/tree/main/lua/which-key?), but it seems too intrusive. Open to other ideas.

@qwrtln
Copy link
Author

qwrtln commented Jan 28, 2025

Thank you for trying. I don't think I'm familiar enough with nvim's API to make any meaningful suggestion. Feel free to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help needed Need help from contributors
Projects
None yet
Development

No branches or pull requests

2 participants