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

"f" doesn't work when system language is changed (to Russian). #39

Closed
D00mch opened this issue May 11, 2019 · 15 comments
Closed

"f" doesn't work when system language is changed (to Russian). #39

D00mch opened this issue May 11, 2019 · 15 comments

Comments

@D00mch
Copy link

D00mch commented May 11, 2019

I click 'f', links are highlighted with English letters, and I can't click on them with keyboard if my system language is not English.
Is there a work around this?

@gdh1995
Copy link
Owner

gdh1995 commented May 11, 2019

yes, it's indeed one item (key code translation) vimium c lacking compared with vimium.

Current working-around is to replace the "character for link hints" option with characters in your keyboard language (Russian).

I haven't got enough ideas to handle other keyboard layout correctly. It's not very suitable to just copy vimium's code.

@D00mch
Copy link
Author

D00mch commented May 11, 2019

Thanks for quick answer.
The problem is that most of the time I need english characters, but when I am chatting or searching for location specific stuff, I change my keyboard to Russian.

So the working-around you proposed won't suit my use case.

@gdh1995
Copy link
Owner

gdh1995 commented May 11, 2019

vimium c has a command of toggleLinkHintCharacters to change chars for link hints only on a current page and the usage is map key... toggleLinkHintCharacters value="russian-chars", and then it switches between the default chars and this configured chars.

Or, you may map Ru LinkHints.activate characters="russian-chars", then Ru will trigger link hints using given russian chars. And the Ru may be replaced with a russian key sequence.

PS: LinkHints uses altkey, ctrlkey, shiftKeys to toggle some switches like open-in-new-tab, open-multi-tab, open-tab-and-activate.

@D00mch
Copy link
Author

D00mch commented May 11, 2019

For some cases these will do the trick, but the idea is to automize it so you don't have to think about it at all.

@gdh1995
Copy link
Owner

gdh1995 commented May 28, 2019

Currently there's a feature of "mapped keys": https://github.com/philc/vimium/wiki/Tips-and-Tricks#key-mapping, which translates keys and then can be used to translate characters in other languages to English characters, to activate corresponding commands.

So, do you like the idea to apply such translation also to LinkHints' inner logic? Then if you map some Russian characters to English characters, the two keyboard layouts will generate same key sequence for Vimium C.

gdh1995 added a commit that referenced this issue Jun 2, 2019
@D00mch
Copy link
Author

D00mch commented Jun 21, 2019

I think this will be OK.
Just to check...

For example, now I have some mappings like:

map г scrollPageUp

Instead of this I will have
map г u

And this will also work for f. Am I correct?

@gdh1995
Copy link
Owner

gdh1995 commented Jun 21, 2019

No. Sorry I didn't explain it as clearly as I could. Here's a detailed version.

Basically, a "Characters for Link Hints" may be asdghjkl, which corresponds to фывпролд on a Russian Keyboard. And then, if you add such key mapping rules:

# note: `mapKey` option is default to be `true`
map f LinkHints.activateMode
mapKey а f

# note: a mapped lower-case alphabet means to translate all related
# e.g.: <c-ф> -> <c-a>; Ф -> A
mapKey ф a
mapKey ы s
mapKey в d
mapKey п g
mapKey р h
mapKey о j
mapKey л k
mapKey д l

Then Vimium C will translate а (Russian version of f) to f in the "normal" mode, and translate ы to s in "LinkHints" mode. Therefore, you can press the s key to activate a link, without considering about which keyboard layouts you're using.

================

Well, after testing for minutes, this feature is indeed not so good as I once expected - LinkHints will translate all hint characters to their UPPER-CASE version, so you need to write UPPER-CASE Russian+English characters after mapKey. Maybe I'll update this feature in some days it's been updated since v1.76.0.

Conclusion: this feature has landed on Vimum C v1.75.5 and v1.75.7, you may have a try.

=======

Updated: now the mapKey option is enabled by default, and a false will turn off this feature.

@D00mch
Copy link
Author

D00mch commented Jun 21, 2019

Seems to work, thank you!
The only moment I found is when I press caps "F", I can't then proceed with Russian letters. But I can handle this with pressing "f" and then caps letter (to open in new tab).

@gdh1995
Copy link
Owner

gdh1995 commented Jun 21, 2019

It's because this feature is not enabled by default - you need to add an option of mapKey=true after map *** LinkHints.***.

The first line of the example above is map f LinkHints.activateMode mapKey=true, so you may write map F LinkHints.activateModeToOpenInNewTab mapKey=true

=======

Updated: now the mapKey option is enabled by default, and a false will turn off this feature.

@D00mch
Copy link
Author

D00mch commented Jun 21, 2019

Thanks! Everything works as I wanted)

gdh1995 added a commit that referenced this issue Jun 22, 2019
somehow aligned to the philc/Vimium;
also for
  #39 (comment)

and fix a bug of mapping keys twice if InsertMode is active
@gdh1995
Copy link
Owner

gdh1995 commented Jul 9, 2019

Hello, now the mapKey option for LinkHints is enabled by default, and if a lower-case character is mapKey-ed, then its upper case will also be translated to a corresponding upper-case one.

So, could you have a try? And, if there're no bugs about it, I wonder if we may close this issue - I still have no recent plan to implement a feature of auto ignoring keyboard layout like #17 , so this mapKey method should be the most suitable in several months.

@D00mch
Copy link
Author

D00mch commented Jul 9, 2019

Everything works fine, thanks! I think we may close the issue.

@ww7
Copy link

ww7 commented Jul 14, 2019

Full list for Cyrillic (Russian and Ukrainian) mapKey's

mapKey й q
mapKey ц w
mapKey у e
mapKey к r
mapKey е t
mapKey н y
mapKey г u
mapKey ш i
mapKey щ o
mapKey з p
mapKey х [
mapKey Х {
mapKey ъ ]
mapKey Ъ }
mapKey ї ]
mapKey Ї }
# <space> after \
mapKey ё \ 
mapKey Ё |
mapKey ґ \ 
mapKey Ґ |
mapKey ф a
mapKey ы s
mapKey і s
mapKey в d
mapKey а f
mapKey п g
mapKey р h
mapKey о j
mapKey л k
mapKey д l
mapKey ж ;
mapKey Ж :
mapKey э '
mapKey Э "
mapKey є '
mapKey Є "
mapKey я z
mapKey ч x
mapKey с c
mapKey м v
mapKey и b
mapKey т n
mapKey ь m
mapKey б ,
mapKey Б <
mapKey ю .
mapKey Ю >
# '.' and ',' overrides (disables this keys for mappings)
mapKey . / 
mapKey , ?

upd: Added space after \. Works!

@gdh1995
Copy link
Owner

gdh1995 commented Jul 14, 2019

@ww7 Thanks a lot! And the reason why mapKey ... \ fails is that the \ character is treated as a "line" connector - it makes the next text line be joined into the current line. So a mapKey ё \\ should work.

Update: after tests, the method above fails, I'm debugging.

Update: a work-around of this bug is to append a space character after \, and ensure every line which ends with \ is not the last one.

gdh1995 added a commit that referenced this issue Jul 14, 2019
@gdh1995
Copy link
Owner

gdh1995 commented Jul 14, 2019

Well, I've collected related information and write a Wiki page: https://github.com/gdh1995/vimium-c/wiki/Use-in-another-keyboard-layout , and in Vimium C v1.76.2 the option page will contain a link referring to it.

Update: v1.76.2 has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants