Skip to content

Instantly share code, notes, and snippets.

@nekova
Created June 21, 2017 10:06
Show Gist options
  • Save nekova/06ebbac17ef77375b7744f8e6990d974 to your computer and use it in GitHub Desktop.
Save nekova/06ebbac17ef77375b7744f8e6990d974 to your computer and use it in GitHub Desktop.
hammerspoon
local function pressFn(mods, key)
if key == nil then
key = mods
mods = {}
end
return function() hs.eventtap.keyStroke(mods, key, 1000) end
end
local function remap(mods, key, pressFn)
hs.hotkey.bind(mods, key, pressFn, nil, pressFn)
end
-- dvorak only. it means jkil on qwerty
remap({'option'}, 'h', pressFn('left'))
remap({'option'}, 't', pressFn('down'))
remap({'option'}, 'c', pressFn('up'))
remap({'option'}, 'n', pressFn('right'))
remap({'option', 'cmd'}, 'h', pressFn({'cmd'}, 'left'))
remap({'option', 'cmd'}, 't', pressFn({'cmd'}, 'down'))
remap({'option', 'cmd'}, 'c', pressFn({'cmd'}, 'up'))
remap({'option', 'cmd'}, 'n', pressFn({'cmd'}, 'right'))
remap({'option', 'shift'}, 'h', pressFn({'shift'}, 'left'))
remap({'option', 'shift'}, 't', pressFn({'shift'}, 'down'))
remap({'option', 'shift'}, 'c', pressFn({'shift'}, 'up'))
remap({'option', 'shift'}, 'n', pressFn({'shift'}, 'right'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment