Sublime Forum

Is `fn` a valid modifier key?

#1

I tried making some keyboard shortcuts using the fn key as a modifier, and I thought I had briefly had some working (fn+d to duplicate_line, for instance), but it was under a key remapping and now all seems broken, just does not seem to work.

According to wikipedia fn is a modifier key, also according to Karabiner (my OSX key remapper).

But I take it, ST does not support fn as a modifier?

0 Likes

#2

My guess would be that it’s used by the operating system in combination with the key you press to come up with the final action and thus not visible to user programs. Also I don’t think fn is in the list of potential modifiers that Sublime understands.

However your best bet is to open the console with View > Show Console and enter sublime.log_input(True), then press the key you want to bind and see what it reports. Whatever is logged (if anything) is how Sublime sees that key for binding purposes.

3 Likes

#3

OK I tried it. Sublime draws a blank face on fn i.e., does not react to the keypress at all.

The key event viewer that comes with Karabiner does show fn as a normal down/up keypress, however, so I’m pretty confident than fn keypresses are not simply gobbled up by the system before reaching applications.

Maybe supporting fn as an extra modifier could be on the to-do list for some future version of ST?

0 Likes

#4

Highly doubt it will ever be supported by Sublime (or any other software) because is a diferent kind of event and is more like a hardware issue (i.e. various keyboards, various implementations).

Fn keys generate ACPI events and not keyboard events. To echo the keypress for Fn to the terminal use …


If you’re on a Windows machine, maybe you can get away with a trickery involving Autohotkey to catch this (from what I’ve read in the past, it only works on certain keyboards).

2 Likes

#5

If you’re on a Windows machine, maybe you can get away with a trickery involving Autohotkey to catch this (from what I’ve read in the past, it only works on certain keyboards).

I’m on OSX but anyway I can already use Karabiner to remap fn to whatever I want, such as option / command / control, or any combination thereof.

Maybe I should clarify: I am not interested in using the physical fn key directly—it’s too far away from the home row! Instead, I wanted to remap Caps Lock to fn, so that Caps Lock would become a brand-new modifier to work with. But since fn does not work as a modifier key, these hopes are dashed.

I understand that some people remap Caps Lock to some kind of “hyper” combination like shift+ctrl+option+command, to make it into a “unique” modifier. The problem is that such a combination cannot be used in combination with any of the keys that make up the combination. E.g., command+caps lock would be the same as caps lock, with caps lock as just defined.

If ST can’t support the fn modifier, maybe it could add support for left- and right-handed versions of modifiers, to be used by the discerning power user? This would take the number of (theoretically) available modifiers from 4 to 8.

0 Likes