Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
-- 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
You can’t perform that action at this time.