2

I highly doubt this is possible, but it's worth a try...

I have a new MacBook Pro, and I find myself ( as a VIM user ) accidentally hitting the F1 ( decrease Brightness) key regularly, when trying to hit ESC to get back into normal mode. I have remapped F1 to ESC in my .vimrc, but it seems that the key doesn't register as F1 unless I have fn held down. I know how to change this behavior in the System Preferences, but there are some function keys, like the volume control keys, that I want left how they are.

Sorry if this confusing, basically what I would like to know is whether I can set the Brightness keys to be set to F1 and F2 by default, while keeping the volume control keys set to volume control by default....

1
  • If none of the answers satisfy your need, you should add that to you question.
    – Daniel Beck
    Sep 28, 2010 at 15:05

4 Answers 4

1

You want FunctionFlip.

1

Another option is to use a private.xml like this with KeyRemap4MacBook:

<?xml version="1.0"?>
<root>
  <item>
    <name>fkeys</name>
    <identifier>fkeys</identifier>
    <only>FKEYS</only>
    <autogen>__KeyToKey__ KeyCode::BRIGHTNESS_DOWN, KeyCode::F1</autogen>
    <autogen>__KeyToKey__ KeyCode::BRIGHTNESS_UP, KeyCode::F2</autogen>
    <autogen>__KeyToKey__ KeyCode::F1, KeyCode::BRIGHTNESS_DOWN</autogen>
    <autogen>__KeyToKey__ KeyCode::F2, KeyCode::BRIGHTNESS_UP</autogen>
  </item>
</root>

This would flip all F-keys when MacVim is frontmost:

<?xml version="1.0"?>
<root>
  <appdef>
    <appname>MACVIM</appname>
    <equal>org.vim.MacVim</equal>
  </appdef>
  <item>
    <name>fkeys</name>
    <identifier>fkeys</identifier>
    <only>MACVIM</only>
    <autogen>__KeyToKey__ KeyCode::BRIGHTNESS_DOWN, KeyCode::F1</autogen>
    <autogen>__KeyToKey__ KeyCode::BRIGHTNESS_UP, KeyCode::F2</autogen>
    <autogen>__KeyToKey__ KeyCode::EXPOSE_ALL, KeyCode::F3</autogen>
    <autogen>__KeyToKey__ KeyCode::LAUNCHPAD, KeyCode::F4</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::KEYBOARDLIGHT_LOW, KeyCode::F5</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::KEYBOARDLIGHT_HIGH, KeyCode::F6</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::MUSIC_PREV, KeyCode::F7</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::MUSIC_PLAY, KeyCode::F8</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::MUSIC_NEXT, KeyCode::F9</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::VOLUME_MUTE, KeyCode::F10</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::VOLUME_DOWN, KeyCode::F11</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::VOLUME_UP, KeyCode::F12</autogen>
    <autogen>__KeyToKey__ KeyCode::F1, KeyCode::BRIGHTNESS_DOWN</autogen>
    <autogen>__KeyToKey__ KeyCode::F2, KeyCode::BRIGHTNESS_UP</autogen>
    <autogen>__KeyToKey__ KeyCode::F3, KeyCode::EXPOSE_ALL</autogen>
    <autogen>__KeyToKey__ KeyCode::F4, KeyCode::LAUNCHPAD</autogen>
    <autogen>__KeyToKey__ KeyCode::F5, ConsumerKeyCode::KEYBOARDLIGHT_LOW</autogen>
    <autogen>__KeyToKey__ KeyCode::F6, ConsumerKeyCode::KEYBOARDLIGHT_HIGH</autogen>
    <autogen>__KeyToKey__ KeyCode::F7, ConsumerKeyCode::MUSIC_PREV</autogen>
    <autogen>__KeyToKey__ KeyCode::F8, ConsumerKeyCode::MUSIC_PLAY</autogen>
    <autogen>__KeyToKey__ KeyCode::F9, ConsumerKeyCode::MUSIC_NEXT</autogen>
    <autogen>__KeyToKey__ KeyCode::F10, ConsumerKeyCode::VOLUME_MUTE</autogen>
    <autogen>__KeyToKey__ KeyCode::F11, ConsumerKeyCode::VOLUME_DOWN</autogen>
    <autogen>__KeyToKey__ KeyCode::F12, ConsumerKeyCode::VOLUME_UP</autogen>
  </item>
</root>
1
  • KeyRemap4MacBook is now called Karabiner (pqrs.org/osx/karabiner/index.html.en). I was able to use it to remap Fn keys on my Kinesis Freestyle2 Bluetooth keyboard when FunctionFlip didn't work.
    – Lawrence
    Jan 10, 2017 at 23:10
0

You can invert fn behaviour and use tool like Spark to map keys you need to media actions.

0

Another related app which you may find useful for situations where you want the F1-F12 keys primary in one OSX application, and the brightness/volume/etc keys active in other apps, is Paula.

In addition to the function key mode following app focus, Paula also provides a configurable hotkey combination for toggling the current mode.

You must log in to answer this question.