gdh1995 / vimium-c

A keyboard shortcut browser extension for keyboard-based navigation and tab operations with an advanced omnibar
https://chrome.google.com/webstore/detail/vimium-c/hfjbmagddngcpeloejdejnfgbamkjaeg
Other
3.17k stars 253 forks source link

Interesting, but strange behavior. #1099

Closed shynekomaid closed 3 months ago

shynekomaid commented 4 months ago

I found a strange behavior. As far as I know - (minus sign) in vi means go to the beginning of the previous line. But the behavior seems to be different in vimiumc. As I understand it, it changes the modifier of the number of commands. Conditionally, 10j means to go 10 lines down. At the same time -10j (minus sign, 10, j) - go 10 lines up. I checked with the d and u commands - it works too - turns the behavior around.

Question #1: is this the way it was intended to be designed? If so, it's a very cool feature, but I didn't see the information in the documentation.

Question #2: what is the behavior with other commands (to be honest, it's a bit creepy to check)?

No matter but: Vimium C 1.99.99; Linux Mint 21.3; Cinnamon 6.0.4; Kernel 6.5.0-18-generic; Chrome Version 121.0.6167.184 (Official Build) (64-bit)

shynekomaid commented 4 months ago

Also, -j (minus j without numbers) mean k and vise-versa

gdh1995 commented 3 months ago

Question #1: is this the way it was intended to be designed?

Yes it works by design.

what is the behavior with other commands

In Vimium C, most commands supports "count prefix", if only its operating target can be numbered, and then, if an operation is directional, then such a command will accept "negative count prefix" (otherwise it just use the absolute value of prefixed count).

Therefore, if a key of - is a first key, then it always serve as count prefix, and - + non-number-key indicates -1 + non-number-key, so you may see -j works just as -1j and k.

You may add unmap - to custom key mappings to disable this feature in normal mode, and then map - scrollDown will be accepted in Vimium C. But unmap directives are not recognized in visual mode, so you'll need something like mapKey <-:v> j to change how VisualMode deal with the - key (see https://github.com/gdh1995/vimium-c/discussions/1094).

shynekomaid commented 3 months ago

@gdh1995. I wanted to extend my gratitude. Your explanation clarifies the intentional design behind the functionality, which I find quite fascinating.

Thank you once again for your assistance and for sharing your expertise on this matter. Vimium C is cool!

Best regards, shynekomaid