nvim-lua / nvim-lua/kickstart.nvim

which-key breaks `vim.v.count` in visual mode

Open
#2,047 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
31.5k
Forks
46.6k
Avg merge
2d 16h
Merged PRs (30d)
4

Description

This bug has been reported in which-key here, but that was 2 years ago so it seems unlikely that it will be fixed. Making an issue here for discussion.

Reproduction

  1. Go to this line (currently 901 on master), and put your cursor on the first '. I marked cursor pos with | |
    local parsers = { |'|bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
  2. Type v]n2]n
    Confirm that 'diff' is selected when in reality 'html' should be selected
  3. To confirm that which-key is the issue, remove the installation lines for only which-key, and do the above steps again

Discussion
While certainly an edge case, this is indeed a bug. #2046 stops which-key from triggering in visual mode to fix this, but I don't think it's a good solution. Open to discussion for better solutions.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the visual-mode sequence v]n2]n at the indicated parser list, first with which-key installed and then without it. Read the discussion in #2046 and the linked which-key issue to understand how the plugin affects vim.v.count; done means visual-mode counts select the expected item without breaking which-key behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.