Closed 1ace closed 4 years ago
So in order for quick-scope to operate (when using the highlight on keys mode) it re-maps f
/F
etc.
I'm not sure if there is a way for counts to be visible to a mapping. I've done some searching but so far haven't found anything. The help page :help map-examples
has a section called "Multiplying a count", which shows how mappings behave with a count but doesn't mention any way for the mapping to know about the count. The quick-scope mappings are bit of an abnormal case because they are functions that do the highlighting and return a string for the command to execute.
Counts are visible to user defined commands however, see :help command-count
. So there may be a way to change quick-scope's internals to map to a command in order to gain visibility to the count (which would allow us to move the highlight respective to the count).
All that said, this will only effect anyone using the highlight on keys mode, the vanilla highlight mode simply highlights the whole line and has no idea when the user even presses f
because it doesn't need to have a mapping.
I understand this is a complicated issue and will likely not be fixed soon (and I expected as much tbh). Thanks for the detailed report :ok_hand:
Let's leave this issue open, both for other people to find if they have the same question/issue, and as a potential TODO item :+1:
Can v:count1
be used for this? I got this working: https://github.com/ayyess/quick-scope/commit/34f6f57f66e50a4e0d4764e918305be1c70d96a0
It looks like it can, and much simpler than I thought the fix would need to be. I somehow missed v:count1
in searching how to do this. @ayyess I can merge your change if you want to submit a pull request.
Oh that's awesome! Thanks everyone :+1:
Let's say I have the following line:
If I'm on the first character (
A
) and I press f, it highlights the following characters:That's correct, as those are the words I would move to if I press the suggested character.
But if I press 2f, it still highlights the same characters:
But that's incorrect, as pressing the suggested character will not move the cursor to the corresponding word.
In such a case, it should highlight the
n
th character when it appears in a word, and nothing in the cases where no character from the word is then
th character.