Best way to set up cut/copy/paste/undo keys on Function layer?



I use Dvorak and typically like to use a macro program such as AHK to rebind the following:

Ctrl + ;
Ctrl + q
Ctrl + j
Ctrl + k

To take advantage of the OS clipboard and undo:

Ctrl + z
Ctrl + x
Ctrl + c
Ctrl + v

I’d like to change the Function layer to do this instead to obviate the need for the installing the macros on every computer I visit. So Fn + ; becomes Ctrl + z and so on.

What would be the best way to do this? I have been cruising around the forum and Googling looking for an existing solution with no success and haven’t been able to figure out how to do it on my own further than how to edit and flash keymaps.

(Andrew McCauley) #2

This would be pretty easy to do with Macros. Define a few macros with the keypresses you want for ctrl-z/x/c/v and assign them to the function layer in the positions you want.


Thanks for the tip. Here’s what I’ve got so far working from the example:

// Give a name to the macros!
enum {

// Somewhere in the keymap:

// later in the Sketch:
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
  switch (macroIndex) {
  case MACRO_UNDO:
    //return Ctrl + z keypress
    return ;
  case MACRO_CUT:
    //return Ctrl + x keypress
  case MACRO_COPY:
    //return Ctrl + r keypress
    //return Ctrl + v keypress
  return MACRO_NONE;

void setup() {
  Kaleidoscope.setup ();

I’m not sure how to return the key combinations. Can someone advise?

(Andrew McCauley) #4

If you look towards the bottom of that list, it shows you how to input keys down, up and tapped, so you’d want something like MACRODOWN(D(LeftControl), T(Z/X/C/V), U(LeftControl)) in there


Added that and merged it with my main .ino file. Works perfectly, thanks for your help!

(Andrew McCauley) #6

Glad I could help someone this time rather than being the one to ask for help!