Skip to content

Instantly share code, notes, and snippets.

@jacobthemyth
Created January 16, 2017 18:21
Show Gist options
  • Save jacobthemyth/a5484213c33e2c66d52d1ce5f22b2cfc to your computer and use it in GitHub Desktop.
Save jacobthemyth/a5484213c33e2c66d52d1ce5f22b2cfc to your computer and use it in GitHub Desktop.
-- http://www.hammerspoon.org/docs/hs.hotkey.html
local function keyCode(key, modifiers)
modifiers = modifiers or {}
return function()
hs.eventtap.event.newKeyEvent(modifiers, string.lower(key), true):post()
hs.timer.usleep(1000)
hs.eventtap.event.newKeyEvent(modifiers, string.lower(key), false):post()
end
end
hs.hotkey.bind({'ctrl'}, 'n', keyCode('down'), nil, keyCode('down'))
hs.hotkey.bind({'ctrl'}, 'p', keyCode('up'), nil, keyCode('up'))
hs.hotkey.bind({'ctrl', 'shift'}, 'n', keyCode('down', {'shift'}), nil, keyCode('down', {'shift'}))
hs.hotkey.bind({'ctrl', 'shift'}, 'p', keyCode('up', {'shift'}), nil, keyCode('up', {'shift'}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment